mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-15 00:17:42 +00:00
potentially fix redis script
This commit is contained in:
parent
408c813309
commit
12435d7605
1 changed files with 2 additions and 3 deletions
|
@ -120,10 +120,9 @@ func SchedulerCmd(ctx context.Context) *cobra.Command {
|
||||||
func evalScript(ctx context.Context, redis *redis.Client) (string, error) {
|
func evalScript(ctx context.Context, redis *redis.Client) (string, error) {
|
||||||
lua := fmt.Sprintf(`
|
lua := fmt.Sprintf(`
|
||||||
local retv={}
|
local retv={}
|
||||||
local ids=cjson.decode(ARGV[1])
|
|
||||||
|
|
||||||
for i=1, #ids do
|
for i=1, #ARGV do
|
||||||
local key = KEYS[1] .. ":" .. ids[i]
|
local key = KEYS[1] .. ":" .. ARGV[i]
|
||||||
if redis.call("exists", key) == 0 then
|
if redis.call("exists", key) == 0 then
|
||||||
redis.call("setex", key, %.0f, 1)
|
redis.call("setex", key, %.0f, 1)
|
||||||
retv[#retv + 1] = ids[i]
|
retv[#retv + 1] = ids[i]
|
||||||
|
|
Loading…
Reference in a new issue