From 88098ae00f84e2b03b0601fe65c8383d2dbaac9a Mon Sep 17 00:00:00 2001 From: "H.John Choi" Date: Sat, 5 Aug 2023 16:30:47 +0900 Subject: [PATCH 1/3] fix: prevent creating unnecessary threads repeatedly Use ThreadPoolScheduler for WriteApi batch subject instead of TimeoutScheduler. Fixes #561 --- influxdb_client/client/write_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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' From c75d44c9afc63690e56978023551da2dff4f7e79 Mon Sep 17 00:00:00 2001 From: "H.John Choi" Date: Sat, 5 Aug 2023 17:09:07 +0900 Subject: [PATCH 2/3] docs: Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e4ebc1..0e6a4e53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ ### Documentation 1. [#566](https://github.com/influxdata/influxdb-client-python/pull/566): Fix Sphinx documentation build and add support `.readthedocs.yml` V2 configuration file +### 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.37.0 [2023-07-28] ### Breaking Changes From ab4a528df34e4ee867715399ffd2336fd476ef75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bedn=C3=A1=C5=99?= Date: Thu, 4 Jan 2024 10:07:59 +0100 Subject: [PATCH 3/3] docs: update CHANGELOG.md --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e6a4e53..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 @@ -14,9 +17,6 @@ ### Documentation 1. [#566](https://github.com/influxdata/influxdb-client-python/pull/566): Fix Sphinx documentation build and add support `.readthedocs.yml` V2 configuration file -### 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.37.0 [2023-07-28] ### Breaking Changes