Skip to content

New Locksmith failure backend to clean up locks#2

Closed
raykrueger wants to merge 2 commits intomasterfrom
unknown repository
Closed

New Locksmith failure backend to clean up locks#2
raykrueger wants to merge 2 commits intomasterfrom
unknown repository

Conversation

@raykrueger
Copy link
Contributor

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?

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.
@raykrueger
Copy link
Contributor Author

Hold off on this Chris, I'm looking at adding failure hooks for DirtyExits to resque.

@defunkt
Copy link
Owner

defunkt commented Sep 17, 2011

Sweet. Is there any way we can activate this automatically?

@raykrueger
Copy link
Contributor Author

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?

@raykrueger
Copy link
Contributor Author

@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 :)

@defunkt
Copy link
Owner

defunkt commented Sep 22, 2011

Resque::Failure::Multiple would be a nice default.

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.
@alexfarrill
Copy link

Eager to try the new lock, tons of locks left around in the current version

@raykrueger
Copy link
Contributor Author

Yeah that's what lead to me going down this road for all this stuff.
If you use my resque fork (raykrueger/resque) that has the current patches for the on_failure lock handling in combination with this commit here; you will no longer have locks left behind.

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

@maxmeyer
Copy link

+1

@raykrueger raykrueger closed this Jan 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments