set the key only if it doesn't exist, otherwise it will never expire

This commit is contained in:
Andre Medeiros 2021-07-09 00:11:05 -04:00
parent fb9741f7e0
commit 961e41094d

View file

@ -197,9 +197,9 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, statsd *statsd.
for i=1, #ids do for i=1, #ids do
local key = "locks:accounts:" .. ids[i] local key = "locks:accounts:" .. ids[i]
if redis.call("exists", key) == 0 then if redis.call("exists", key) == 0 then
redis.call("setex", key, 60, 1)
retv[#retv + 1] = ids[i] retv[#retv + 1] = ids[i]
end end
redis.call("setex", key, 60, 1)
end end
return retv return retv