Skip to content

Commit

Permalink
Let forward requests run until timeout (thanos-io#2679)
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
kakkoyun authored and thisisobate committed Jun 1, 2020
1 parent a65286d commit c0b6be2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,17 @@ func (h *Handler) replicate(ctx context.Context, tenant string, wreq *prompb.Wri
}
h.mtx.RUnlock()

var err error
ctx, cancel := context.WithTimeout(ctx, h.options.ForwardTimeout)
defer cancel()
defer func() {
// If there is no error, let forward requests optimistically run until timeout.
if err != nil {
cancel()
}
}()

quorum := h.writeQuorum()
err := h.fanoutForward(ctx, tenant, replicas, wreqs, quorum)
err = h.fanoutForward(ctx, tenant, replicas, wreqs, quorum)
if countCause(err, isNotReady) >= quorum {
return tsdb.ErrNotReady
}
Expand Down

0 comments on commit c0b6be2

Please sign in to comment.