Skip to content

Commit

Permalink
Let forward requests run until timeout (#2679)
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
kakkoyun authored May 29, 2020
1 parent 6dcdf11 commit 92fa67d
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 92fa67d

Please sign in to comment.