MCPcopy
hub / github.com/redis/go-redis / newClusterClient

Method newClusterClient

osscluster_test.go:62–88  ·  view source on GitHub ↗
(
	ctx context.Context, opt *redis.ClusterOptions,
)

Source from the content-addressed store, hash-verified

60}
61
62func (s *clusterScenario) newClusterClient(
63 ctx context.Context, opt *redis.ClusterOptions,
64) *redis.ClusterClient {
65 client := s.newClusterClientUnstable(opt)
66 client.SetCommandInfoResolver(client.NewDynamicResolver())
67 err := eventually(func() error {
68 if opt.ClusterSlots != nil {
69 return nil
70 }
71
72 state, err := client.LoadState(ctx)
73 if err != nil {
74 return err
75 }
76
77 if !state.IsConsistent(ctx) {
78 return fmt.Errorf("cluster state is not consistent")
79 }
80
81 return nil
82 }, 30*time.Second)
83 if err != nil {
84 panic(err)
85 }
86
87 return client
88}
89
90func (s *clusterScenario) Close() error {
91 ctx := context.TODO()

Callers 5

BenchmarkClusterPingFunction · 0.80
BenchmarkClusterDoIntFunction · 0.80
osscluster_test.goFile · 0.80
race_test.goFile · 0.80

Calls 6

eventuallyFunction · 0.85
NewDynamicResolverMethod · 0.80
LoadStateMethod · 0.80
IsConsistentMethod · 0.80

Tested by

no test coverage detected