@@ -255,11 +255,12 @@ def __init__(self,
255
255
# Define Subject that listen incoming data and produces writes into InfluxDB
256
256
self ._subject = Subject ()
257
257
258
+ self ._window_scheduler = ThreadPoolScheduler (1 )
258
259
self ._disposable = self ._subject .pipe (
259
260
# Split incoming data to windows by batch_size or flush_interval
260
261
ops .window_with_time_or_count (count = write_options .batch_size ,
261
262
timespan = timedelta (milliseconds = write_options .flush_interval ),
262
- scheduler = ThreadPoolScheduler ( 1 ) ),
263
+ scheduler = self . _window_scheduler ),
263
264
# Map window into groups defined by 'organization', 'bucket' and 'precision'
264
265
ops .flat_map (lambda window : window .pipe (
265
266
# Group window by 'organization', 'bucket' and 'precision'
@@ -440,6 +441,11 @@ def __del__(self):
440
441
)
441
442
break
442
443
444
+ if self ._window_scheduler :
445
+ self ._window_scheduler .executor .shutdown ()
446
+ self ._window_scheduler .executor = None
447
+ self ._window_scheduler = None
448
+
443
449
if self ._disposable :
444
450
self ._disposable = None
445
451
pass
@@ -565,6 +571,7 @@ def __getstate__(self):
565
571
# Remove rx
566
572
del state ['_subject' ]
567
573
del state ['_disposable' ]
574
+ del state ['_window_scheduler' ]
568
575
del state ['_write_service' ]
569
576
return state
570
577
0 commit comments