MCPcopy Create free account
hub / github.com/cortexproject/cortex / WaitRingTokensStability

Function WaitRingTokensStability

pkg/ring/util.go:73–75  ·  view source on GitHub ↗

WaitRingTokensStability waits for the Ring to be unchanged at least for minStability time period, excluding transitioning between allowed states (e.g. JOINING->ACTIVE if allowed by op). This can be used to avoid wasting resources on moving data around due to multiple changes in the Ring.

(ctx context.Context, r *Ring, op Operation, minStability, maxWaiting time.Duration)

Source from the content-addressed store, hash-verified

71// This can be used to avoid wasting resources on moving data around
72// due to multiple changes in the Ring.
73func WaitRingTokensStability(ctx context.Context, r *Ring, op Operation, minStability, maxWaiting time.Duration) error {
74 return waitStability(ctx, r, op, minStability, maxWaiting, HasReplicationSetChangedWithoutState)
75}
76
77func waitStability(ctx context.Context, r *Ring, op Operation, minStability, maxWaiting time.Duration, isChanged func(ReplicationSet, ReplicationSet) bool) error {
78 // Configure the max waiting time as a context deadline.

Calls 1

waitStabilityFunction · 0.85