Skip to content

Commit

Permalink
Fix assertStableCommand logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekshenawa committed Sep 2, 2024
1 parent ca4e352 commit 5b0bb85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ require (
)

retract (
v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead.
v9.5.4 // This version was accidentally released. Please use version 9.6.0 instead.
v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead.
)
19 changes: 9 additions & 10 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,17 @@ func (c *baseClient) process(ctx context.Context, cmd Cmder) error {
return lastErr
}

func (c *baseClient) assertStableCommand(ctx context.Context, cmd Cmder) bool {
if c.opt.Protocol != 2 && c.opt.UnstableResp3SearchModule {
switch cmd.(type) {
case *AggregateCmd, *FTInfoCmd, *FTSpellCheckCmd, *FTSearchCmd, *FTSynDumpCmd:
internal.Logger.Printf(ctx, "Some RESP3 results for Redis Query Engine responses may change. Refer to the readme for guidance")
func (c *baseClient) assertStableCommand(cmd Cmder) bool {
switch cmd.(type) {
case *AggregateCmd, *FTInfoCmd, *FTSpellCheckCmd, *FTSearchCmd, *FTSynDumpCmd:
if c.opt.UnstableResp3SearchModule {
return true
default:
return false
} else {
panic("Some RESP3 results for Redis Query Engine responses may change. Refer to the readme for guidance")
}
default:
return false
}
return false

}

func (c *baseClient) _process(ctx context.Context, cmd Cmder, attempt int) (bool, error) {
Expand All @@ -443,7 +442,7 @@ func (c *baseClient) _process(ctx context.Context, cmd Cmder, attempt int) (bool
}
readReplyFunc := cmd.readReply
// Apply unstable RESP3 search module.
if c.assertStableCommand(ctx, cmd) {
if c.opt.Protocol != 2 && c.assertStableCommand(cmd) {
readReplyFunc = cmd.readRawReply
}
if err := cn.WithReader(c.context(ctx), c.cmdTimeout(cmd), readReplyFunc); err != nil {
Expand Down

0 comments on commit 5b0bb85

Please sign in to comment.