Class: SidekiqRobustJob::UniquenessStrategy::WhileExecuting

Inherits:
Base
  • Object
show all
Defined in:
lib/sidekiq_robust_job/uniqueness_strategy/while_executing.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SidekiqRobustJob::UniquenessStrategy::Base

Instance Method Details

#execute(job) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/sidekiq_robust_job/uniqueness_strategy/while_executing.rb', line 4

def execute(job)
  lock(job) do |locked|
    if locked
      perform_job_and_finalize(job)
    else
      job.reschedule and return
    end
  end
end