Skip to content

Commit

Permalink
Merge pull request #193 from influxdata/192/writeBatchingExplained
Browse files Browse the repository at this point in the history
feat(docs): explain writeApi buffering in the example and api docs
  • Loading branch information
sranka authored Jun 2, 2020
2 parents 716ec09 + 57d798e commit 09312f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
### Documentation

1. [#189](https://github.com/influxdata/influxdb-client-js/pull/189): Add timestamp to write example.
1. [#193](https://github.com/influxdata/influxdb-client-js/pull/193): Explain write API buffering in the write example and API docs.

## 1.3.0 [2020-05-15]

Expand Down
4 changes: 3 additions & 1 deletion examples/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const point2 = new Point('temperature')
writeApi.writePoint(point2)
console.log(` ${point2.toLineProtocol(writeApi)}`)

// flush pending writes and close writeApi
// WriteApi always buffer data into batches to optimize data transfer to InfluxDB server and retries
// writing upon server/network failure. writeApi.flush() can be called to flush the buffered data,
// close() also flushes the remaining buffered data and then cancels pending retries.
writeApi
.close()
.then(() => {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/WriteApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Point from './Point'

/**
* The asynchronous buffering API to Write time-series data into InfluxDB 2.0.
* This API always buffers points/lines to create batches under the hood
* to optimize data transfer to InfluxDB server, use `flush` to send
* the buffered data to InfluxDB immediately.
* <p>
* The data are formatted in [Line Protocol](https://bit.ly/2QL99fu).
* <p>
Expand Down

0 comments on commit 09312f3

Please sign in to comment.