Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Fixed scheduled jobs locking #20

Merged
merged 3 commits into from
Jan 22, 2014
Merged

Conversation

dmeremyanin
Copy link
Collaborator

Move unique key generation to worker class and refactored code a bit.

/cc @krasnoukhov

@krasnoukhov
Copy link
Owner

Hey @dimko, thanks for refactoring. Could you please describe which exact issue this intended to fix?

@dmeremyanin
Copy link
Collaborator Author

Hi, we don't need to set unique key in redis for scheduled jobs unless unique option is set to :all.
For example:

class UniqueWorker
  include Sidekiq::Worker
  sidekiq_options queue: :unique_queue, unique: true

  def perform(x)
  end
end

at = Time.now.to_f
5.times { Sidekiq::Client.push('class' => UniqueWorker, 'args' => ['args'], 'at' => at) } # Scheduled jobs
assert_equal 5, Sidekiq.redis { |c| c.zcard('schedule') }

This fails on master.

@krasnoukhov
Copy link
Owner

Ok, this all looks good. Thanks!

krasnoukhov added a commit that referenced this pull request Jan 22, 2014
Fixed scheduled jobs locking
@krasnoukhov krasnoukhov merged commit 870f1bc into krasnoukhov:master Jan 22, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants