MCPcopy Index your code
hub / github.com/CodisLabs/codis / subscribeDispatch

Method subscribeDispatch

pkg/utils/redis/sentinel.go:159–173  ·  view source on GitHub ↗
(ctx context.Context, sentinel string, timeout time.Duration,
	onSubscribed func())

Source from the content-addressed store, hash-verified

157}
158
159func (s *Sentinel) subscribeDispatch(ctx context.Context, sentinel string, timeout time.Duration,
160 onSubscribed func()) (bool, error) {
161 var err = s.dispatch(ctx, sentinel, timeout, func(c *Client) error {
162 return s.subscribeCommand(c, sentinel, onSubscribed)
163 })
164 if err != nil {
165 switch errors.Cause(err) {
166 case context.Canceled, context.DeadlineExceeded:
167 return false, nil
168 default:
169 return false, err
170 }
171 }
172 return true, nil
173}
174
175func (s *Sentinel) Subscribe(sentinels []string, timeout time.Duration, onMajoritySubscribed func()) bool {
176 cntx, cancel := context.WithTimeout(s.Context, timeout)

Callers 1

SubscribeMethod · 0.95

Calls 2

dispatchMethod · 0.95
subscribeCommandMethod · 0.95

Tested by

no test coverage detected