class AtomicSidekiq::AtomicOperation::Expire

Constants

EXPIRE_SCRIPT

Public Class Methods

new() click to toggle source
# File lib/atomic_sidekiq/atomic_operation/expire.rb, line 9
def initialize
  super(in_flight_keymaker: nil)
end

Public Instance Methods

perform(queue, in_flight_key, recover:) click to toggle source
# File lib/atomic_sidekiq/atomic_operation/expire.rb, line 13
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