Class: Cloudtasker::UniqueJob::ConflictStrategy::Reschedule

Inherits:
BaseStrategy
  • Object
show all
Defined in:
lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb

Overview

This strategy reschedules the job on conflict. This strategy can only be used with processing locks (e.g. while_executing).

Constant Summary collapse

RESCHEDULE_DELAY =

seconds

5

Instance Attribute Summary

Attributes inherited from BaseStrategy

#job

Instance Method Summary collapse

Methods inherited from BaseStrategy

#initialize

Constructor Details

This class inherits a constructor from Cloudtasker::UniqueJob::ConflictStrategy::BaseStrategy

Instance Method Details

#on_executeObject

Reschedule the job.



24
25
26
# File 'lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb', line 24

def on_execute
  job.worker.reenqueue(RESCHEDULE_DELAY)
end

#on_scheduleObject

A conflict on schedule means that this strategy is being used with a lock scheduling strategy (e.g. until_executed) instead of a processing strategy (e.g. while_executing). In this case we let the scheduling happen as it does not make sense to reschedule in this context.



17
18
19
# File 'lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb', line 17

def on_schedule
  yield
end