Don't let slow disk plugin thread delay shutdown (#14044)
* dont sleep for all duration of step * empty line
Emmanuel Vasilakis committed
Nov 25, 2022 at 12:00 UTC
d628eecf9d2a6ecb047dae8e1517999c5be63ba8
1 file changed
+8
-1
collectors/diskspace.plugin/plugin_diskspace.c
+8
-1
@@ -511,12 +511,19 @@ void *diskspace_slow_worker(void *ptr)
511
netdata_thread_cleanup_push(diskspace_slow_worker_cleanup, data->slow_thread);
512
513
usec_t step = slow_update_every * USEC_PER_SEC;
514
+ usec_t real_step = USEC_PER_SEC;
515
heartbeat_t hb;
516
heartbeat_init(&hb);
517
518
while(!netdata_exit) {
519
worker_is_idle();
519
- heartbeat_next(&hb, step);
520
+ heartbeat_next(&hb, USEC_PER_SEC);
521
+
522
+ if (real_step < step) {
523
+ real_step += USEC_PER_SEC;
524
+ continue;
525
+ }
526
+ real_step = USEC_PER_SEC;
527
528
usec_t start_time = now_monotonic_high_precision_usec();
529