MCPcopy
hub / github.com/grafana/dskit / discoverMembersWithRetries

Method discoverMembersWithRetries

kv/memberlist/memberlist_client.go:953–972  ·  view source on GitHub ↗

Like discoverMembers() but retries (up to 10 times) on error.

(ctx context.Context, members []string)

Source from the content-addressed store, hash-verified

951
952// Like discoverMembers() but retries (up to 10 times) on error.
953func (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.

Calls 4

discoverMembersMethod · 0.95
NewFunction · 0.92
OngoingMethod · 0.80
WaitMethod · 0.45