lantins / resque-lock-timeout

A Resque plugin; adds locking, with optional timeout/deadlock handling to resque jobs.
MIT License
53 stars 20 forks source link

Added a method to handle jobs when a lock was already acquired #5

Closed morellon closed 13 years ago

morellon commented 13 years ago

Added a method to handle jobs when a lock was already acquired. This would allow, for example, to override the abort_lock method to requeue messages that were not processed (avoiding to lose messages from the queue)

lantins commented 13 years ago

Thanks! I'm going to rename the method and add a unit test, will be included in the next release.

lantins commented 13 years ago

Scrap that, there is already the ability to define lock_failed in your job and handle a lock failure.

https://github.com/lantins/resque-lock-timeout/blob/master/lib/resque/plugins/lock_timeout.rb#L95

morellon commented 13 years ago

Sorry about that. I don't remember seeing this method there, my bad.

lantins commented 13 years ago

No worries! I forgot about the hook method myself =)

I've made the hook methods more clear in the code now: https://github.com/lantins/resque-lock-timeout/blob/master/lib/resque/plugins/lock_timeout.rb#L88