Skip to content

Commit

Permalink
Wait on all ingesters to complete processing before returning success
Browse files Browse the repository at this point in the history
Errors still immediately return an error
  • Loading branch information
splitice committed May 25, 2022
1 parent 5206e3a commit 7dd0f7f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,23 +386,27 @@ func (d *Distributor) sendSamples(ctx context.Context, ingester ring.InstanceDes
//
// The use of atomic increments here guarantees only a single sendSamples
// goroutine will write to either channel.
done := false
for i := range streamTrackers {
if err != nil {
if streamTrackers[i].failed.Inc() <= int32(streamTrackers[i].maxFailures) {
continue
}
if pushTracker.samplesFailed.Inc() == 1 {
if !done && pushTracker.samplesFailed.Inc() == 1 {
pushTracker.err <- err
}
} else {
if streamTrackers[i].succeeded.Inc() != int32(streamTrackers[i].minSuccess) {
continue
}
if pushTracker.samplesPending.Dec() == 0 {
pushTracker.done <- struct{}{}
done = true
}
}
}
if done {
pushTracker.done <- struct{}{}
}
}

// TODO taken from Cortex, see if we can refactor out an usable interface.
Expand Down

0 comments on commit 7dd0f7f

Please sign in to comment.