(ctx context.Context, sentinel string, timeout time.Duration, onSubscribed func())
| 157 | } |
| 158 | |
| 159 | func (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 | |
| 175 | func (s *Sentinel) Subscribe(sentinels []string, timeout time.Duration, onMajoritySubscribed func()) bool { |
| 176 | cntx, cancel := context.WithTimeout(s.Context, timeout) |
no test coverage detected