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 UntilExecuted not working while the job is executing? #319

Closed
soundasleep opened this issue Aug 7, 2018 · 1 comment
Closed

Unique UntilExecuted not working while the job is executing? #319

soundasleep opened this issue Aug 7, 2018 · 1 comment

Comments

@soundasleep
Copy link
Contributor

soundasleep commented Aug 7, 2018

Describe the bug
I have a unique job set up like with the following options:

class Addresses::BitpayWorker
  include Sidekiq::Worker

  sidekiq_options lock: :until_executed,
        on_conflict: :log

  def perform(account_id)
    logger.info "Starting with #{account_id}"
    # ...
  end
end

I'm not sure how, but it seems in 6.0.5 this job can now actually run multiple times simultaneously. It was working fine in 5.x. Screenshot of Sidekiq UI:

duplicate unique jobs

The Sidekiq log:

2018-08-07T23:13:33.653Z 10288 TID-18x2eo Addresses::BitpayWorker JID-c86b911e8e2b193c4dbfbf4d INFO: start
2018-08-07T23:13:33.721Z 10288 TID-18x2eo Addresses::BitpayWorker JID-c86b911e8e2b193c4dbfbf4d INFO: Starting with 55994
2018-08-07T23:13:44.650Z 10288 TID-18wz3s Addresses::BitpayWorker JID-b2843af345ae144b714bb067 INFO: start
2018-08-07T23:13:44.707Z 10288 TID-18wz3s Addresses::BitpayWorker JID-b2843af345ae144b714bb067 INFO: Starting with 55994
2018-08-07T23:13:45.602Z 10288 TID-18x2eo Addresses::BitpayWorker JID-c86b911e8e2b193c4dbfbf4d INFO: Updating account 55994 with 0.0 BTC
2018-08-07T23:13:45.663Z 10288 TID-18wz3s Addresses::BitpayWorker JID-b2843af345ae144b714bb067 INFO: Updating account 55994 with 0.0 BTC
2018-08-07T23:13:47.959Z 10288 TID-18x34k Addresses::BitpayWorker JID-9b3e2e0a0ad835d49c2c75f4 INFO: start
2018-08-07T23:13:48.013Z 10288 TID-18x34k Addresses::BitpayWorker JID-9b3e2e0a0ad835d49c2c75f4 INFO: Starting with 55994
2018-08-07T23:13:58.237Z 10288 TID-18x34k Addresses::BitpayWorker JID-9b3e2e0a0ad835d49c2c75f4 INFO: Updating account 55994 with 0.0 BTC
2018-08-07T23:14:07.977Z 10288 TID-18x34k Addresses::BitpayWorker JID-9b3e2e0a0ad835d49c2c75f4 FATAL: the unique_key: uniquejobs:3b4ae16c0866118249e420647e33ce90 needs to be unlocked manually
2018-08-07T23:14:07.977Z 10288 TID-18x34k Addresses::BitpayWorker JID-9b3e2e0a0ad835d49c2c75f4 INFO: done: 20.018 sec
2018-08-07T23:14:08.020Z 10288 TID-18x2eo Addresses::BitpayWorker JID-c86b911e8e2b193c4dbfbf4d FATAL: the unique_key: uniquejobs:3b4ae16c0866118249e420647e33ce90 needs to be unlocked manually
2018-08-07T23:14:08.020Z 10288 TID-18x2eo Addresses::BitpayWorker JID-c86b911e8e2b193c4dbfbf4d INFO: done: 34.367 sec
2018-08-07T23:14:08.131Z 10288 TID-18wz3s Addresses::BitpayWorker JID-b2843af345ae144b714bb067 FATAL: the unique_key: uniquejobs:3b4ae16c0866118249e420647e33ce90 needs to be unlocked manually
2018-08-07T23:14:08.131Z 10288 TID-18wz3s Addresses::BitpayWorker JID-b2843af345ae144b714bb067 INFO: done: 23.48 sec

Expected behavior
UntilExecuted queue should prevent jobs from being queued while a matching job exists in the queue, or is currently being executed.

Current behavior
As above.

@soundasleep
Copy link
Contributor Author

Never mind, this was due to a bug I had introduced in the UntilExecuted code (using unless instead of if).

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

1 participant