swanson/stringer — pull request #223 by thecoffman (2013-07-12 19:28:57+00:00)
Title: Add Rake task for cleaning up old stories

A new rake task has been added: cleanup_read. This will delete
the oldest 1000 read stories in the database. You can pass in a different
number of stories to delete as an argument to the rake task.

rake cleanup_read[50]

Everything is pretty straightforward and working. Thought it might be useful for people with a lot of feeds running on the free tier of heroku as I believe they limit you to 10k rows.

Only thing that seems a little lame is the .each(:&delete) which fires a delete for each story. Unfortunately delete_all doesn't work with a .lmit() in the query, and I am unaware of any workarounds.

Thoughts?