fix(query): release the query results before requesting statistics (#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.
pull/12637/head
Jonathan A. Sternberg 2019-03-14 11:12:53 -05:00 committed by GitHub
parent e3ac5ffecf
commit 0d045630c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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