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 ca89c08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/components/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Flags:
if no max_source_resolution param is specified.
--query.partial-response Enable partial response for queries if no
partial_response param is specified.
--store.response-timeout=0ms
--store.response-timeout=0ms
If a Store doesn't send any data in this
specified duration then a Store will be ignored
and partial data will be returned if it's
Expand Down
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 ca89c08

Please sign in to comment.