Skip to content

Commit

Permalink
fix: use ThreadPoolScheduler for WriteApi batch subject to prevent cr…
Browse files Browse the repository at this point in the history
…eate threads repeteadly
  • Loading branch information
goznauk committed Aug 5, 2023
1 parent a804c51 commit 65ee74b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion influxdb_client/client/write_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 65ee74b

Please sign in to comment.