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

Function startSentinel

main_test.go:327–343  ·  view source on GitHub ↗
(port, masterName, masterPort string)

Source from the content-addressed store, hash-verified

325}
326
327func startSentinel(port, masterName, masterPort string) (*redis.Client, error) {
328 client, err := connectTo(port)
329 if err != nil {
330 return nil, err
331 }
332
333 for _, cmd := range []*redis.StatusCmd{
334 redis.NewStatusCmd(ctx, "SENTINEL", "MONITOR", masterName, "127.0.0.1", masterPort, "2"),
335 } {
336 client.Process(ctx, cmd)
337 if err := cmd.Err(); err != nil && !strings.Contains(err.Error(), "ERR Duplicate master name.") {
338 return nil, fmt.Errorf("%s failed: %w", cmd, err)
339 }
340 }
341
342 return client, nil
343}
344
345//------------------------------------------------------------------------------
346

Callers 1

main_test.goFile · 0.85

Calls 5

connectToFunction · 0.85
ProcessMethod · 0.65
ErrMethod · 0.65
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected