Sha256: b6e564f2fc6085250f17f0238d483176411f3a46d4a4aebdf71875dd36a727d0

Contents?: true

Size: 862 Bytes

Versions: 52

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

module Cloudtasker
  module UniqueJob
    module ConflictStrategy
      # This strategy reschedules the job on conflict. This strategy can only
      # be used with processing locks (e.g. while_executing).
      class Reschedule < BaseStrategy
        RESCHEDULE_DELAY = 5 # seconds

        #
        # 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.
        #
        def on_schedule
          yield
        end

        #
        # Reschedule the job.
        #
        def on_execute
          job.worker.reenqueue(RESCHEDULE_DELAY)
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
cloudtasker-0.12.rc3 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.11.0 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.11.rc3 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.11.rc2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.11.rc1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.9.4 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.0 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.9.3 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc8 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc7 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc6 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc5 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc4 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc3 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.rc1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.9.2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb