From 961e41094dab3f90a6ecccbc65cc10bcf1add389 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Fri, 9 Jul 2021 00:11:05 -0400 Subject: [PATCH] set the key only if it doesn't exist, otherwise it will never expire --- cmd/apollo-scheduler/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/apollo-scheduler/main.go b/cmd/apollo-scheduler/main.go index f6abf5c..ee439e3 100644 --- a/cmd/apollo-scheduler/main.go +++ b/cmd/apollo-scheduler/main.go @@ -197,9 +197,9 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, statsd *statsd. for i=1, #ids do local key = "locks:accounts:" .. ids[i] if redis.call("exists", key) == 0 then + redis.call("setex", key, 60, 1) retv[#retv + 1] = ids[i] end - redis.call("setex", key, 60, 1) end return retv