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 <harkrisp@amazon.com>
This commit is contained in:
Harkrishn Patro 2024-08-08 13:28:45 -07:00 committed by GitHub
parent 109cc21267
commit 7424620ca0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1420,8 +1420,8 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
} }
/* Run the Cluster cron. */ /* Run the Cluster cron. */
run_with_period(100) { if (server.cluster_enabled) {
if (server.cluster_enabled) clusterCron(); run_with_period(100) clusterCron();
} }
/* Run the Sentinel timer if we are in sentinel mode. */ /* 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; server.rdb_bgsave_scheduled = 0;
} }
run_with_period(100) { if (moduleCount()) {
if (moduleCount()) modulesCron(); run_with_period(100) modulesCron();
} }
/* Fire the cron loop modules event. */ /* Fire the cron loop modules event. */