mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 11:47:42 +00:00
set the key only if it doesn't exist, otherwise it will never expire
This commit is contained in:
parent
fb9741f7e0
commit
961e41094d
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue