Sha256: 3e793ef8dd6df99747bbdb6204a3106b82f90cdc2468214907cf127bfea1bc35

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

module AtomicSidekiq
  module AtomicOperation
    class Retrieve < Base
      def perform(queues, expire_at)
        queues.each do |queue|
          res = retrieve_from_queue(queue, expire_at.to_i)
          return res if res
        end
        nil
      end

      private

      RETRIEVE_SCRIPT = File.read(File.join(File.dirname(__FILE__), './lua_scripts/retrieve.lua'))

      def retrieve_from_queue(queue, expire_at)
        redis do |conn|
          conn.eval(RETRIEVE_SCRIPT, [queue, in_flight_prefix], [expire_at])
        end
      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/retrieve.rb