Skip to content

Commit

Permalink
Check if the server is currently running the feature before cron run (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
hpatro authored Aug 8, 2024
1 parent 109cc21 commit 7424620
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 7424620

Please sign in to comment.