Skip to content

Commit 8286f45

Browse files
goznaukbednar
andauthored
fix: prevent creating unnecessary threads repeatedly (influxdata#562)
* fix: prevent creating unnecessary threads repeatedly Use ThreadPoolScheduler for WriteApi batch subject instead of TimeoutScheduler. Fixes influxdata#561 * docs: Update CHANGELOG.md * docs: update CHANGELOG.md --------- Co-authored-by: Jakub Bednář <[email protected]>
1 parent eb5afd1 commit 8286f45

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 1.40.0 [unreleased]
22

3+
### Bug Fixes
4+
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
5+
36
## 1.39.0 [2023-12-05]
47

58
### Features

influxdb_client/client/write_api.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ def __init__(self,
258258
self._disposable = self._subject.pipe(
259259
# Split incoming data to windows by batch_size or flush_interval
260260
ops.window_with_time_or_count(count=write_options.batch_size,
261-
timespan=timedelta(milliseconds=write_options.flush_interval)),
261+
timespan=timedelta(milliseconds=write_options.flush_interval),
262+
scheduler=ThreadPoolScheduler(1)),
262263
# Map window into groups defined by 'organization', 'bucket' and 'precision'
263264
ops.flat_map(lambda window: window.pipe(
264265
# Group window by 'organization', 'bucket' and 'precision'

0 commit comments

Comments
 (0)