Skip to content

Commit

Permalink
fix: prevent creating unnecessary threads repeatedly (#562)
Browse files Browse the repository at this point in the history
* fix: prevent creating unnecessary threads repeatedly

Use ThreadPoolScheduler for WriteApi batch subject instead of TimeoutScheduler.

Fixes #561

* docs: Update CHANGELOG.md

* docs: update CHANGELOG.md

---------

Co-authored-by: Jakub Bednář <[email protected]>
goznauk and bednar authored Jan 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent eb5afd1 commit 8286f45
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 1.40.0 [unreleased]

### Bug Fixes
1. [#562](https://github.com/influxdata/influxdb-client-python/pull/562): Use `ThreadPoolScheduler` for `WriteApi`'s batch subject instead of `TimeoutScheduler` to prevent creating unnecessary threads repeatedly

## 1.39.0 [2023-12-05]

### Features
3 changes: 2 additions & 1 deletion influxdb_client/client/write_api.py
Original file line number Diff line number Diff line change
@@ -258,7 +258,8 @@ def __init__(self,
self._disposable = self._subject.pipe(
# Split incoming data to windows by batch_size or flush_interval
ops.window_with_time_or_count(count=write_options.batch_size,
timespan=timedelta(milliseconds=write_options.flush_interval)),
timespan=timedelta(milliseconds=write_options.flush_interval),
scheduler=ThreadPoolScheduler(1)),
# Map window into groups defined by 'organization', 'bucket' and 'precision'
ops.flat_map(lambda window: window.pipe(
# Group window by 'organization', 'bucket' and 'precision'

0 comments on commit 8286f45

Please sign in to comment.