Class: AtomicSidekiq::AtomicOperation::Expire
- Defined in:
- lib/atomic_sidekiq/atomic_operation/expire.rb
Constant Summary collapse
- EXPIRE_SCRIPT =
File.read( File.join(File.dirname(__FILE__), "./lua_scripts/expire.lua") )
Instance Method Summary collapse
-
#initialize ⇒ Expire
constructor
A new instance of Expire.
- #perform(queue, in_flight_key, recover:) ⇒ Object
Constructor Details
#initialize ⇒ Expire
Returns a new instance of Expire.
9 10 11 |
# File 'lib/atomic_sidekiq/atomic_operation/expire.rb', line 9 def initialize super(in_flight_keymaker: nil) end |
Instance Method Details
#perform(queue, in_flight_key, recover:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |