Sha256: 60538d7128f9d3d35f62df4041d1815a0e1d0ec5b2f34df032c39ef27b2f3eab

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

module AtomicSidekiq
  module AtomicOperation
    class Expire < Base
      EXPIRE_SCRIPT = File.read(
        File.join(File.dirname(__FILE__),
                  "./lua_scripts/expire.lua")
      )

      def initialize
        super(in_flight_keymaker: nil)
      end

      def perform(queue, in_flight_key, recover:)
        redis do |conn|
          conn.eval(
            EXPIRE_SCRIPT,
            [
              queue, # Queue Name
              in_flight_key, # Key of the inflight job being expired
            ],
            [
              Time.now.utc.to_i, # Current time
              recover, # Boolean flag: should it be recovered if expired
            ]
          )
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atomic-sidekiq-1.3.0 lib/atomic_sidekiq/atomic_operation/expire.rb
atomic-sidekiq-1.2.0 lib/atomic_sidekiq/atomic_operation/expire.rb