diff --git a/cluster.go b/cluster.go index b21f9453..4a8b8466 100644 --- a/cluster.go +++ b/cluster.go @@ -828,15 +828,21 @@ func askingMulti(cc conn, ctx context.Context, multi []Completed) *redisresults } func askingMultiCache(cc conn, ctx context.Context, multi []CacheableTTL) *redisresults { - commands := make([]Completed, 0, len(multi)*6) + commands := make([]Completed, 0, len(multi)*7) for _, cmd := range multi { ck, _ := cmds.CacheKey(cmd.Cmd) - commands = append(commands, cmds.OptInCmd, cmds.MultiCmd, cmds.AskingCmd, cmds.NewCompleted([]string{"PTTL", ck}), Completed(cmd.Cmd), cmds.ExecCmd) + commands = append(commands, cmds.OptInCmd, cmds.MultiCmd, cmds.AskingCmd, cmds.NewCompleted([]string{"PTTL", ck}), cmds.AskingCmd, Completed(cmd.Cmd), cmds.ExecCmd) } results := resultsp.Get(0, len(multi)) resps := cc.DoMulti(ctx, commands...) - for i := 5; i < len(resps.s); i += 6 { + for i := 6; i < len(resps.s); i += 7 { if arr, err := resps.s[i].ToArray(); err != nil { + for _, j := range []int{i - 3, i - 1} { // check if PTTL or {Cmd} failed + if preErr := resps.s[j].Error(); preErr != nil { + err = preErr + break + } + } results.s = append(results.s, newErrResult(err)) } else { results.s = append(results.s, newResult(arr[len(arr)-1], nil))