Skip to content

Commit

Permalink
Add UnstableResp3SearchModule to client options
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekshenawa committed Aug 31, 2024
1 parent 3408303 commit d30695a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
3 changes: 3 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ type Options struct {

// Add suffix to client name. Default is empty.
IdentitySuffix string

// Enable Unstable mode for Redis Search module with RESP3.
UnstableResp3SearchModule bool
}

func (opt *Options) init() {
Expand Down
5 changes: 3 additions & 2 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"
"fmt"
"net" // TODO change to import only specific method (Not necesarry in compiling)
"net"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -442,7 +442,8 @@ func (c *baseClient) _process(ctx context.Context, cmd Cmder, attempt int) (bool
return err
}
readReplyFunc := cmd.readReply
if c.isProblematicMethodsOfSearchResp3(cmd) {
// Apply unstable RESP3 search module.
if c.opt.UnstableResp3SearchModule && c.isProblematicMethodsOfSearchResp3(cmd) {
readReplyFunc = cmd.readRawReply
}
if err := cn.WithReader(c.context(ctx), c.cmdTimeout(cmd), readReplyFunc); err != nil {
Expand Down
10 changes: 6 additions & 4 deletions ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ type RingOptions struct {
TLSConfig *tls.Config
Limiter Limiter

DisableIndentity bool
IdentitySuffix string
DisableIndentity bool
IdentitySuffix string
UnstableResp3SearchModule bool
}

func (opt *RingOptions) init() {
Expand Down Expand Up @@ -166,8 +167,9 @@ func (opt *RingOptions) clientOptions() *Options {
TLSConfig: opt.TLSConfig,
Limiter: opt.Limiter,

DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
}
}

Expand Down
15 changes: 9 additions & 6 deletions sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ type FailoverOptions struct {

TLSConfig *tls.Config

DisableIndentity bool
IdentitySuffix string
DisableIndentity bool
IdentitySuffix string
UnstableResp3SearchModule bool
}

func (opt *FailoverOptions) clientOptions() *Options {
Expand Down Expand Up @@ -117,8 +118,9 @@ func (opt *FailoverOptions) clientOptions() *Options {

TLSConfig: opt.TLSConfig,

DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
}
}

Expand Down Expand Up @@ -154,8 +156,9 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options {

TLSConfig: opt.TLSConfig,

DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
}
}

Expand Down
15 changes: 9 additions & 6 deletions universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ type UniversalOptions struct {

MasterName string

DisableIndentity bool
IdentitySuffix string
DisableIndentity bool
IdentitySuffix string
UnstableResp3SearchModule bool
}

// Cluster returns cluster options created from the universal options.
Expand Down Expand Up @@ -158,8 +159,9 @@ func (o *UniversalOptions) Failover() *FailoverOptions {

TLSConfig: o.TLSConfig,

DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
UnstableResp3SearchModule: o.UnstableResp3SearchModule,
}
}

Expand Down Expand Up @@ -201,8 +203,9 @@ func (o *UniversalOptions) Simple() *Options {

TLSConfig: o.TLSConfig,

DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
UnstableResp3SearchModule: o.UnstableResp3SearchModule,
}
}

Expand Down

0 comments on commit d30695a

Please sign in to comment.