Sha256: 4efd3ddc7045f0f0f1cc5b5be778fbf33f76ae30997bcbe4b9edf2c2bd3001f0

Contents?: true

Size: 646 Bytes

Versions: 52

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

module Cloudtasker
  module UniqueJob
    module ConflictStrategy
      # This strategy raises an error on conflict, both on client and server side.
      class Raise < BaseStrategy
        RESCHEDULE_DELAY = 5 # seconds

        # Raise a Cloudtasker::UniqueJob::LockError
        def on_schedule
          raise_lock_error
        end

        # Raise a Cloudtasker::UniqueJob::LockError
        def on_execute
          raise_lock_error
        end

        private

        def raise_lock_error
          raise(UniqueJob::LockError, id: job.id, unique_id: job.unique_id)
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
cloudtasker-0.9.1 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.9.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.8.2 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.8.1 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.8.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.7.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.6.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.5.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.4.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.3.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.2.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb
cloudtasker-0.1.0 lib/cloudtasker/unique_job/conflict_strategy/raise.rb