Sha256: ee66dd149f4d2138265245a0bf0b44a60b33d6e091e43c8e48a960893f73272a

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

local queue = KEYS[1]
local in_flight_key = KEYS[2]
local now = tonumber(ARGV[1])

local job = redis.call('get', in_flight_key)
if (not job) then return nil end

local expiration = tonumber(string.match(job, '"expire_at":([0-9]*)'))
if expiration > now then return nil end
job = string.gsub(job, ',?"expire_at":[0-9]*', '')

redis.call('lpush', queue, job)
redis.call('del', in_flight_key)

return { queue, job }

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
atomic-sidekiq-1.1.4 lib/atomic_sidekiq/atomic_operation/lua_scripts/expire.lua
atomic-sidekiq-1.1.3 lib/atomic_sidekiq/atomic_operation/lua_scripts/expire.lua
atomic-sidekiq-1.1.2 lib/atomic_sidekiq/atomic_operation/lua_scripts/expire.lua
atomic-sidekiq-1.1.0 lib/atomic_sidekiq/atomic_operation/lua_scripts/expire.lua
atomic-sidekiq-1.0.0 lib/atomic_sidekiq/atomic_operation/lua_scripts/expire.lua