Skip to content

Commit

Permalink
fix(query): release the query results before requesting statistics (#…
Browse files Browse the repository at this point in the history
…12622)

The statistics are only finalized after release is called. Defer a call
to release to ensure they are released, but explicitly release on
success to ensure that the statistics are finalized from all sources
before returning them.
  • Loading branch information
jsternberg committed Mar 14, 2019
1 parent e3ac5ff commit 0d04563
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions query/bridges.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ func (b ProxyQueryServiceAsyncBridge) Query(ctx context.Context, w io.Writer, re
defer results.Release()

encoder := req.Dialect.Encoder()
_, err = encoder.Encode(w, results)
if err != nil {
if _, err := encoder.Encode(w, results); err != nil {
return flux.Statistics{}, tracing.LogError(span, err)
}
results.Release()

stats := results.Statistics()
return stats, nil
Expand Down

0 comments on commit 0d04563

Please sign in to comment.