Skip to content

Commit

Permalink
Add better timeout message
Browse files Browse the repository at this point in the history
  • Loading branch information
povilasv committed Mar 22, 2019
1 parent c9142f8 commit fb7c0bd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ func startStreamSeriesSet(
// Next blocks until new message is received or stream is closed or operation is timed out.
func (s *streamSeriesSet) Next() (ok bool) {
ctx := s.ctx
timeoutMsg := ""
timeoutMsg := fmt.Sprintf("failed to receive any data from %s", s.name)

if s.responseTimeout != 0 {
timeoutMsg = s.responseTimeout.String()
timeoutMsg = fmt.Sprintf("failed to receive any data in %s from %s", s.responseTimeout.String(), s.name)

timeoutCtx, done := context.WithTimeout(s.ctx, s.responseTimeout)
defer done()
Expand All @@ -351,8 +351,7 @@ func (s *streamSeriesSet) Next() (ok bool) {
//shutdown a goroutine in startStreamSeriesSet
s.closeSeries()

err := errors.Wrapf(ctx.Err(), "failed to receive any data in %s from %s", timeoutMsg, s.name)

err := errors.Wrap(ctx.Err(), timeoutMsg)
if s.partialResponse {
level.Warn(s.logger).Log("err", err, "msg", "returning partial response")
s.warnCh.send(storepb.NewWarnSeriesResponse(err))
Expand Down

0 comments on commit fb7c0bd

Please sign in to comment.