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

lock_timeout cannot be nil #675

Closed
thatsanicehat opened this issue Jan 11, 2022 · 0 comments · Fixed by #688
Closed

lock_timeout cannot be nil #675

thatsanicehat opened this issue Jan 11, 2022 · 0 comments · Fixed by #688

Comments

@thatsanicehat
Copy link

thatsanicehat commented Jan 11, 2022

Describe the bug

In version 7.1.12, setting lock_timeout to nil for a given worker to ensure the queue waits indefinitely as described in the docs causes an exception

Expected behavior
Setting lock_timeout to nil should continuously re-enqueue the job until it can be picked up.

Current behavior

NoMethodError: undefined method `+' for nil:NilClass (Most recent call first)

File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 327 in drift
(val + 2).to_f * CLOCK_DRIFT_FACTOR
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 331 in add_drift
val + drift(val)
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 244 in primed_async
.value(add_drift(wait || config.timeout))
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 196 in call
primed_method.call(conn, wait) do |primed_jid|
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 196 in block in lock!
primed_method.call(conn, wait) do |primed_jid|
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 228 in enqueue
yield job_id
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 193 in lock!
enqueue(conn) do |queued_jid|
File /app/vendor/bundle/ruby/2.7.0/gems/sidekiq-unique-jobs-7.1.12/lib/sidekiq_unique_jobs/locksmith.rb line 105 in block in execute
lock!(conn, method(:primed_async), &block)

Worker class

class Ops::Scanlite::DisplayPicksWorker < ApplicationWorker
  include Sidekiq::Worker
  sidekiq_options lock: :while_executing, lock_args_method: :lock_args, lock_timeout: nil, retry: false, queue: :dxm

  private

  def self.lock_args(args)
    [args[0]]
  end
end 
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

Successfully merging a pull request may close this issue.

1 participant