Like discoverMembers() but retries (up to 10 times) on error.
(ctx context.Context, members []string)
| 951 | |
| 952 | // Like discoverMembers() but retries (up to 10 times) on error. |
| 953 | func (m *KV) discoverMembersWithRetries(ctx context.Context, members []string) ([]string, error) { |
| 954 | boff := backoff.New(ctx, m.cfg.discoverMembersBackoff) |
| 955 | |
| 956 | var ( |
| 957 | lastErr error |
| 958 | lastAddrs []string |
| 959 | ) |
| 960 | |
| 961 | for boff.Ongoing() { |
| 962 | lastAddrs, lastErr = m.discoverMembers(ctx, members) |
| 963 | if lastErr == nil { |
| 964 | return lastAddrs, nil |
| 965 | } |
| 966 | |
| 967 | boff.Wait() |
| 968 | } |
| 969 | |
| 970 | // We may have both some addresses and error, in case of a partial resolution. |
| 971 | return lastAddrs, lastErr |
| 972 | } |
| 973 | |
| 974 | // While Stopping, we try to leave memberlist cluster and then shutdown memberlist client. |
| 975 | // We do this in order to send out last messages, typically that ingester has LEFT the ring. |