summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2024-05-17 11:27:04 +0300
committerGitHub <noreply@github.com>2024-05-17 11:27:04 +0300
commit9fd7845e9a69c72078b7f7a41dfa49be29aee0f9 (patch)
tree04521bea00db42990b0dbe6a18cd0fec285faceb
parent95f370bd0960af2da1943bca5987c916cd3571c9 (diff)
Fix timex slow shutdown (#17688)
Fix slow shutdown
-rw-r--r--src/collectors/timex.plugin/plugin_timex.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/collectors/timex.plugin/plugin_timex.c b/src/collectors/timex.plugin/plugin_timex.c
index ef4ffea5ca..6a9f50b2c8 100644
--- a/src/collectors/timex.plugin/plugin_timex.c
+++ b/src/collectors/timex.plugin/plugin_timex.c
@@ -62,11 +62,19 @@ void *timex_main(void *ptr)
}
usec_t step = update_every * USEC_PER_SEC;
+ usec_t real_step = USEC_PER_SEC;
heartbeat_t hb;
heartbeat_init(&hb);
while (service_running(SERVICE_COLLECTORS)) {
worker_is_idle();
- heartbeat_next(&hb, step);
+ heartbeat_next(&hb, USEC_PER_SEC);
+
+ if (real_step < step) {
+ real_step += USEC_PER_SEC;
+ continue;
+ }
+ real_step = USEC_PER_SEC;
+
worker_is_busy(0);
struct timex timex_buf = {};