Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locks acquired but job never en-queued? #12

Open
mcfiredrill opened this issue Mar 18, 2013 · 3 comments
Open

locks acquired but job never en-queued? #12

mcfiredrill opened this issue Mar 18, 2013 · 3 comments

Comments

@mcfiredrill
Copy link

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?

@sdeframond
Copy link

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.

@sdeframond
Copy link

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

@f3z0
Copy link

f3z0 commented Dec 3, 2020

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.

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

No branches or pull requests

3 participants