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.14.rc1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.13.2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.13.1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.13.0 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.13.rc2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.13.rc1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.11.1 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.10.2 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.9.5 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.0 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc11 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc10 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc9 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc8 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc7 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc6 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc5 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb
cloudtasker-0.12.rc4 lib/cloudtasker/unique_job/conflict_strategy/reschedule.rb