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

Unique jobs only executed once when used with sidekiq-global_id #235

Closed
moiristo opened this issue Jul 11, 2017 · 2 comments
Closed

Unique jobs only executed once when used with sidekiq-global_id #235

moiristo opened this issue Jul 11, 2017 · 2 comments
Assignees

Comments

@moiristo
Copy link

Hi,

We are using your gem in combination with sidekiq-global_id. Recently, we noticed that jobs with uniqueness constraints were only executed once. It turns out that the root cause for this was that the unique key for the job wasn't removed from the unique jobs hash.

This isn't necessarily a bug. The solution was to change the order of the client/server middleware chain entries to ensure the the digest is always the same:

Sidekiq.client_middleware do |chain|
  chain.add Sidekiq::GlobalId::ClientMiddleware
  chain.add SidekiqUniqueJobs::Client::Middleware
end

Sidekiq.server_middleware do |chain|
  chain.add SidekiqUniqueJobs::Server::Middleware
  chain.add Sidekiq::GlobalId::ServerMiddleware
end

However, it might be a good idea to raise or log an error when a given digest cannot be found in the unique jobs hash. It took me quite some time now to find out why some jobs weren't executing.

@mhenrixon
Copy link
Owner

Thanks for reporting, I will have a look at this at some point!

@mhenrixon mhenrixon self-assigned this Jun 6, 2018
@mhenrixon
Copy link
Owner

Added to readme! Thank you for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants