MCPcopy
hub / github.com/CodisLabs/codis / dispatch

Method dispatch

pkg/utils/redis/sentinel.go:87–107  ·  view source on GitHub ↗
(ctx context.Context, sentinel string, timeout time.Duration,
	fn func(client *Client) error)

Source from the content-addressed store, hash-verified

85}
86
87func (s *Sentinel) dispatch(ctx context.Context, sentinel string, timeout time.Duration,
88 fn func(client *Client) error) error {
89 c, err := NewClientNoAuth(sentinel, timeout)
90 if err != nil {
91 return err
92 }
93 defer c.Close()
94
95 var exit = make(chan error, 1)
96
97 go func() {
98 exit <- fn(c)
99 }()
100
101 select {
102 case <-ctx.Done():
103 return errors.Trace(ctx.Err())
104 case err := <-exit:
105 return err
106 }
107}
108
109func (s *Sentinel) subscribeCommand(client *Client, sentinel string,
110 onSubscribed func()) error {

Callers 5

subscribeDispatchMethod · 0.95
mastersDispatchMethod · 0.95
monitorGroupsDispatchMethod · 0.95
removeGroupsDispatchMethod · 0.95

Calls 3

NewClientNoAuthFunction · 0.85
DoneMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected