resque-lock
resque-lock copied to clipboard
locks acquired but job never en-queued?
I see this strange behavior occasionally, but often enough to want to find a fix. I'll en-queue some jobs. I can see the keys for the locks in the redis cli, but the jobs never seem to run. I don't see them ever appear in their queue or in the history (I use the resque-history plugin as well). Has anyone else ever seen any similar behavior?
Are you raising Resque::Job::DontPerform
in any of your before_perform
hooks?
I am having a similar issue and I think this is the cause.
I finally used this workaround that seems to work fine for my case. Instead of raising directly Resque::Job::DontPerform
I call:
class MyJob
extend Resque::Plugins::Lock
def self.raise_dont_perform(*args)
# Release the lock put by Resque::Plugins::Lock's before_perform hook.
# We need to do that because else we never enter the around_perform
# hook that removes the lock.
Resque.redis.del(lock(*args))
raise Resque::Job::DontPerform
end
end
Sorry a little late to the game here but if you run into this check if you have any other locking plugins like Resque Loner (which for example has a infinite TTL by default so if your process dies midway e.g. DirtyExit it will just stay locked). So you will see this lock expires then reissues but never enqueues.