@cryptotaxi247 / netdata-1 / commits / 9fd7845e9

Fix timex slow shutdown (#17688)

Fix slow shutdown

Stelios Fragkakis committed May 17, 2024 at 11:27 UTC 9fd7845e9a69c72078b7f7a41dfa49be29aee0f9
1 file changed +9 -1
src/collectors/timex.plugin/plugin_timex.c
+9 -1
@@ -62,11 +62,19 @@ void *timex_main(void *ptr)
62 }
63
64 usec_t step = update_every * USEC_PER_SEC;
65 + usec_t real_step = USEC_PER_SEC;
66 heartbeat_t hb;
67 heartbeat_init(&hb);
68 while (service_running(SERVICE_COLLECTORS)) {
69 worker_is_idle();
69 - heartbeat_next(&hb, step);
70 + heartbeat_next(&hb, USEC_PER_SEC);
71 +
72 + if (real_step < step) {
73 + real_step += USEC_PER_SEC;
74 + continue;
75 + }
76 + real_step = USEC_PER_SEC;
77 +
78 worker_is_busy(0);
79
80 struct timex timex_buf = {};