Sha256: 73b00b869c01add5680dd7867f8d3c516ca8cac3f6802a3f6583b0b09f92b96b

Contents?: true

Size: 446 Bytes

Versions: 1

Compression:

Stored size: 446 Bytes

Contents

module AtomicSidekiq
  module AtomicOperation
    class Base
      def initialize(in_flight_prefix:)
        @in_flight_prefix = in_flight_prefix
      end

      protected

      attr_reader :in_flight_prefix

      def redis(&block)
        Sidekiq.redis { |conn| block.call(conn) }
      end

      def in_flight_job_key(queue, job)
        jid = JSON.parse(job)['jid']
        "#{in_flight_prefix}#{queue}:#{jid}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
atomic-sidekiq-1.0.0 lib/atomic_sidekiq/atomic_operation/base.rb