From 7424620ca06c3172ee21af6384080cd6d6463c53 Mon Sep 17 00:00:00 2001 From: Harkrishn Patro Date: Thu, 8 Aug 2024 13:28:45 -0700 Subject: [PATCH] Check if the server is currently running the feature before cron run (#838) I think we should first check if the server is currently enabled in cluster mode or if it has modules loaded prior to the throttled cron run (`run_with_period`) condition. Signed-off-by: Harkrishn Patro --- src/server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server.c b/src/server.c index d332e6989..0f63bcb02 100644 --- a/src/server.c +++ b/src/server.c @@ -1420,8 +1420,8 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { } /* Run the Cluster cron. */ - run_with_period(100) { - if (server.cluster_enabled) clusterCron(); + if (server.cluster_enabled) { + run_with_period(100) clusterCron(); } /* Run the Sentinel timer if we are in sentinel mode. */ @@ -1453,8 +1453,8 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { server.rdb_bgsave_scheduled = 0; } - run_with_period(100) { - if (moduleCount()) modulesCron(); + if (moduleCount()) { + run_with_period(100) modulesCron(); } /* Fire the cron loop modules event. */