@cryptotaxi247 / netdata-1 / commits / c35a8dd42

Remove redundant operations from event loops (#21657)

Remove redundant `uv_stop` and `uv_update_time` calls in async and timer callbacks

Stelios Fragkakis committed Feb 11, 2026 at 13:46 UTC c35a8dd42daadac43eaacd7ffae43024b5971982
3 files changed +5 -17
src/database/engine/rrdengine.c
+1 -6
@@ -1828,9 +1828,6 @@ uint64_t last_async_callback;
1828
1829 void async_cb(uv_async_t *handle)
1830 {
1831 - uv_stop(handle->loop);
1832 - uv_update_time(handle->loop);
1833 -
1831 last_async_callback = uv_hrtime();
1832
1833 netdata_log_debug(D_RRDENGINE, "%s called, active=%d.", __func__, uv_is_active((uv_handle_t *)handle));
@@ -1846,10 +1843,8 @@ static void async_closed_cb(uv_handle_t *handle)
1843 __atomic_store_n(&main->async_ready, true, __ATOMIC_RELEASE);
1844 }
1845 #else
1849 -void async_cb(uv_async_t *handle)
1846 +void async_cb(uv_async_t *handle __maybe_unused)
1847 {
1851 - uv_stop(handle->loop);
1852 - uv_update_time(handle->loop);
1848 netdata_log_debug(D_RRDENGINE, "%s called, active=%d.", __func__, uv_is_active((uv_handle_t *)handle));
1849 }
1850 #endif
src/database/sqlite/sqlite_aclk.c
+2 -5
@@ -301,10 +301,9 @@ struct judy_list_t {
301 Word_t count;
302 };
303
304 -static void async_cb(uv_async_t *handle)
304 +static void async_cb(uv_async_t *handle __maybe_unused)
305 {
306 - uv_stop(handle->loop);
307 - uv_update_time(handle->loop);
306 + ;
307 }
308
309 #define TIMER_PERIOD_MS (1000)
@@ -568,8 +567,6 @@ static void free_query_list(Pvoid_t JudyL)
567
568 static void timer_cb(uv_timer_t *handle)
569 {
571 - uv_stop(handle->loop);
572 - uv_update_time(handle->loop);
570 struct aclk_sync_config_s *config = handle->data;
571
572 if (aclk_online_for_alerts()) {
src/database/sqlite/sqlite_metadata.c
+2 -6
@@ -1545,10 +1545,9 @@ static cmd_data_t metadata_deq_cmd()
1545 return ret;
1546 }
1547
1548 -static void async_cb(uv_async_t *handle)
1548 +static void async_cb(uv_async_t *handle __maybe_unused)
1549 {
1550 - uv_stop(handle->loop);
1551 - uv_update_time(handle->loop);
1550 + ;
1551 }
1552
1553 #define TIMER_INITIAL_PERIOD_MS (1000)
@@ -1556,9 +1555,6 @@ static void async_cb(uv_async_t *handle)
1555
1556 static void timer_cb(uv_timer_t *handle)
1557 {
1559 - uv_stop(handle->loop);
1560 - uv_update_time(handle->loop);
1561 -
1558 struct meta_config_s *config = handle->data;
1559 if (config->metadata_check_after < now_realtime_sec())
1560 config->store_metadata = true;