Skip to content

Commit

Permalink
fix: proper return value of blocking-write-api
Browse files Browse the repository at this point in the history
Pull Request influxdata#350 (commit a9c1e37)
introduced `Flush()` and `Write()` functions blindly returning the
result of a `func (Service) WriteBatch(...) *http2.Error`.
This causes the returned error to always evaluate as `non-nil`.

Fixes influxdata#360
  • Loading branch information
danielorbach committed Oct 19, 2022
1 parent 6bd9713 commit 0292c61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/writeAPIBlocking.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ func (w *writeAPIBlocking) flush(ctx context.Context) error {
body := strings.Join(w.batch, "\n")
w.batch = w.batch[:0]
b := iwrite.NewBatch(body, w.writeOptions.MaxRetryTime())
return w.service.WriteBatch(ctx, b)
if err:= w.service.WriteBatch(ctx, b); err != nil {
return err
}
}
return nil
}
Expand Down

0 comments on commit 0292c61

Please sign in to comment.