{"push_id":652397631,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"d9a1a36b4833bc59ecf9c5e95ebabfa847c79973","before":"ed1a34e36f4f85fb1889aff77826c3e64143a24e","commits":[{"sha":"d9a1a36b4833bc59ecf9c5e95ebabfa847c79973","author":{"email":"acea06ab3d237e846232d4929c3ae98fee2dabd6@gmail.com","name":"amatriain"},"message":"When deleting old entries, iterate using .each instead of .find_each\n\nUnfortunately .find_each is not very flexible. Specifically it doesn't allow setting any other order than \"id asc\". In this case I want a more complex order, because ID fields are usually chronologically ascending but I don't want to bet the farm on it, that's what entries \"published_at\" field is for. This custom ordering of the query is not possible while using .find_each to iterate, the ordering is just ignored by ActiveRecord with a warning in the logs.\n\nI've switched to using .each to iterate over the AR collection, which allows my custom ordering. To limit the number of Entry instances created at once, I've added a limit clause so that only entries which are going to be deleted are actually instantiated. The number of old entries to delete shouldn't be very big, but in a pathological case I suppose an entry could return a huge number of entries that could force a lot of memory to be consumed. It doesn't seem very likely, so for now I'll live with that possibility.","distinct":true,"url":"https://api.github.com/repos/amatriain/feedbunch/commits/d9a1a36b4833bc59ecf9c5e95ebabfa847c79973"}]}