From 83ba6762cc43d9db581b979bb5e3445669e46cc2 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 25 Nov 2024 18:33:56 +0100 Subject: Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145). Signed-off-by: Daniel Baumann --- src/collectors/profile.plugin/plugin_profile.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/collectors/profile.plugin/plugin_profile.cc') diff --git a/src/collectors/profile.plugin/plugin_profile.cc b/src/collectors/profile.plugin/plugin_profile.cc index 390bca29e..14de55db1 100644 --- a/src/collectors/profile.plugin/plugin_profile.cc +++ b/src/collectors/profile.plugin/plugin_profile.cc @@ -117,7 +117,7 @@ public: worker_register_job_custom_metric(WORKER_JOB_METRIC_POINTS_BACKFILLED, "points backfilled", "points", WORKER_METRIC_ABSOLUTE); heartbeat_t HB; - heartbeat_init(&HB); + heartbeat_init(&HB, UpdateEvery * USEC_PER_SEC); worker_is_busy(WORKER_JOB_CREATE_CHARTS); create(); @@ -157,7 +157,7 @@ public: if (CollectionTV.tv_sec >= NowTV.tv_sec) { worker_is_idle(); - heartbeat_next(&HB, UpdateEvery * USEC_PER_SEC); + heartbeat_next(&HB); } } } @@ -194,9 +194,11 @@ static void profile_main_cleanup(void *pptr) { extern "C" void *profile_main(void *ptr) { CLEANUP_FUNCTION_REGISTER(profile_main_cleanup) cleanup_ptr = ptr; - int UpdateEvery = (int) config_get_number(CONFIG_SECTION_PROFILE, "update every", 1); - if (UpdateEvery < localhost->rrd_update_every) + int UpdateEvery = (int) config_get_duration_seconds(CONFIG_SECTION_PROFILE, "update every", 1); + if (UpdateEvery < localhost->rrd_update_every) { UpdateEvery = localhost->rrd_update_every; + config_set_duration_seconds(CONFIG_SECTION_PROFILE, "update every", UpdateEvery); + } // pick low-default values, in case this plugin is ever enabled accidentaly. size_t NumThreads = config_get_number(CONFIG_SECTION_PROFILE, "number of threads", 2); -- cgit v1.2.3