fix: eval api cmd.SetFirstKeyPos (#2501)

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
Monkey 2023-03-28 21:24:04 +08:00 committed by GitHub
parent cccfca4593
commit 2cdd5ea34a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -3323,7 +3323,12 @@ func (c cmdable) eval(ctx context.Context, name, payload string, keys []string,
}
cmdArgs = appendArgs(cmdArgs, args)
cmd := NewCmd(ctx, cmdArgs...)
cmd.SetFirstKeyPos(3)
// it is possible that only args exist without a key.
// rdb.eval(ctx, eval, script, nil, arg1, arg2)
if len(keys) > 0 {
cmd.SetFirstKeyPos(3)
}
_ = c(ctx, cmd)
return cmd
}