errbit/errbit — pull request #238 by cr0t (2012-09-02 22:58:19+00:00)
Title: Rake task to delete unnecessary notices in batch

Hi,

Sometimes some of our apps get out of control (database are gone, or something else was happened). And errbit receives a lot of error notices.

After resolving issue with more then 10000 notices I've tried to delete the unnecessary old ones. Unfortunately I get a timeouts with my unicorns. If I choose to remove notices via rails console my code takes a lot of memory.

So I decided to create a little rake task which automatically removes all notices from database by given problem ID (and without memory consumption, because it uses batches).

**How to use it:**

For example URL for problem "app is out of control" is like this
`http://.../apps/4feb2b1fdd982357f5000001/errs/503d327fdd98230c7900006e`
`503d327fdd98230c7900006e` here is the our problem ID

We can go to the errbit server console and run here notices_delete task like this:
`$ rake 'errbit:db:notices_delete[503d327fdd98230c7900006e]'`
Notices to remove: ...
...