local queue = KEYS local in_flight_key = KEYS local now = tonumber(ARGV) local recover = ARGV == 'true'
local job = redis.call('get', in_flight_key) if (not job) then return nil end
local expiration = tonumber(string.match(job, '“expire_at”:(*)')) if expiration > now then return nil end job = string.gsub(job, ',?“expire_at”:*', '')
if recover then
redis.call('lpush', queue, job)
end redis.call('del', in_flight_key)
return { queue, job }