New Locksmith failure backend to clean up locks#2
New Locksmith failure backend to clean up locks#2raykrueger wants to merge 2 commits intomasterfrom unknown repository
Conversation
When using the Lock plugin locks will be left behind when a job fails due to a DirtyExit. We've been manually deleting them if we see a DirtyExit error, but this is unreliable. This is simply a failure backend to handle that case.
|
Hold off on this Chris, I'm looking at adding failure hooks for DirtyExits to resque. |
|
Sweet. Is there any way we can activate this automatically? |
|
I'm looking at improving the failure callbacks in Resque so that the failure backend isn't necessary. That was coming along well until I got sidetracked by work :) I'll be at Windy City Rails today listening to Mojombo do a talk :) Maybe I'll get it finished up on the train ride. Any chance you're coming out to Chicago today? |
|
@defunkt, have a look at the patch I just sent along for Resque. I think that should cover the fix we need for resque-lock to clean up after itself. Though this failure backend may be useful for anyone who doesn't want to update their resque version. Dunno, we could probably drop this work here though. Working on this I realized the Resque::Failure::Multiple backend is kinda weird. I had considered refactoring Resque to always support multiple failure backends by default. It wold make configuration a ton simpler. A tangent here I suppose though :) |
|
|
Simply added an on_failure hook that removes the lock. This requires resque 1.18 to work, but won't cause errors with a lesser version. A lower version of Resque can still use the Locksmith plugin.
|
Eager to try the new lock, tons of locks left around in the current version |
|
Yeah that's what lead to me going down this road for all this stuff. The locksmith plugin really isn't necessary if you're using the patched resque. Actually defunkt/resque has the on_failure hook, but it has a bug :(. If you're using the resque-retry plugin it'll get queued twice. see also: https://github.com/defunkt/resque/pull/463 |
|
+1 |
When using the Lock plugin locks will be left behind when a job fails due to a
DirtyExit. We've been manually deleting them if we see a DirtyExit error, but
this is unreliable. This is simply a failure backend to handle that case.
I built this out using a Failure backend because there didn't seem to be another way. I'm thinking of adding a failure callback for plugins to resque in the future, whatcha think?