Sha256: 92187fd1774f850871bfe59fb8d53104fa580e110aaaf842917b6f7d7edaff90

Contents?: true

Size: 700 Bytes

Versions: 3

Compression:

Stored size: 700 Bytes

Contents

module AtomicSidekiq
  class UnitOfWork
    attr_reader :queue, :job

    def initialize(queue = nil, job = nil, in_flight_keymaker:)
      @queue          = queue
      @job            = job
      @acknowledge_op = AtomicOperation::Acknowledge.new(
        in_flight_keymaker: in_flight_keymaker
      )
      @requeue_op = AtomicOperation::Requeue.new(
        in_flight_keymaker: in_flight_keymaker
      )
    end

    def acknowledge
      acknowledge_op.perform(job: job)
    end

    def queue_name
      "queue:#{queue.sub(/.*queue:/, '')}"
    end

    def requeue
      requeue_op.perform(queue: queue, job: job)
    end

    private

    attr_reader :acknowledge_op, :requeue_op
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
atomic-sidekiq-1.1.3 lib/atomic_sidekiq/unit_of_work.rb
atomic-sidekiq-1.1.2 lib/atomic_sidekiq/unit_of_work.rb
atomic-sidekiq-1.1.0 lib/atomic_sidekiq/unit_of_work.rb