diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e4ebc1..23f7dc23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/influxdb_client/client/write_api.py b/influxdb_client/client/write_api.py index 61242446..050a7a5c 100644 --- a/influxdb_client/client/write_api.py +++ b/influxdb_client/client/write_api.py @@ -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'