– AUTOGENERATED FILE DO NOT EDIT DIRECTLY local processed_key = KEYS local requeues_count_key = KEYS local queue_key = KEYS local zset_key = KEYS

local max_requeues = tonumber(ARGV) local global_max_requeues = tonumber(ARGV) local test = ARGV local offset = ARGV

if redis.call('sismember', processed_key, test) == 1 then

return false

end

local global_requeues = tonumber(redis.call('hget', requeues_count_key, '_total___')) if global_requeues and global_requeues >= tonumber(global_max_requeues) then

return false

end

local requeues = tonumber(redis.call('hget', requeues_count_key, test)) if requeues and requeues >= max_requeues then

return false

end

redis.call('hincrby', requeues_count_key, '_total___', 1) redis.call('hincrby', requeues_count_key, test, 1)

local pivot = redis.call('lrange', queue_key, -1 - offset, 0 - offset) if pivot then

redis.call('linsert', queue_key, 'BEFORE', pivot, test)

else

redis.call('lpush', queue_key, test)

end

redis.call('zrem', zset_key, test)

return true