tdtran/resque-uniq — pull request #4 by take-five (2013-04-13 19:03:53+00:00)
Title: Delete job locks after kill -9

Hi! Nice plugin. I think I'm going to use it.

However, `resque-uniq` currently relies on `ensure` statement within `around_perform` hook. There are situations when `ensure` block is not executed (for example, when we shutdown a worker with `kill -9` or OOM-killer kills the process etc).

To handle such situations gracefully we can run a simple loop:
```ruby
loop {
Resque.workers.each(&:prune_dead_workers)
sleep 5
}
```

`Resque::Worker#prune_dead_workers` can detect "lost" workers and call `on_failure` callbacks for such jobs and delete corresponding Redis keys.

I've tried to simulate the situation above in tests and written a code to fix it, with a little bit of refactoring. Please take a look at it.

Thanks.