summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuYunlong <xzsyeb@126.com>2019-05-06 11:46:07 +0800
committerantirez <antirez@gmail.com>2019-05-13 16:37:49 +0200
commit72420b0d7a7c6e3efc1e2df1f1e4b46610e031c0 (patch)
tree8eacb6794253a7008d63ea223e0e4cf27ab1ed18
parent33a50d24a5d0f0e09e71e52d7322eb7a1532ea74 (diff)
downloadredis-72420b0d7a7c6e3efc1e2df1f1e4b46610e031c0.tar.gz
Do not active expire keys in the background when the switch is off.
-rw-r--r--src/server.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server.c b/src/server.c
index 4f0045b32..7f0acaa5d 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1000,10 +1000,12 @@ void clientsCron(void) {
void databasesCron(void) {
/* Expire keys by random sampling. Not required for slaves
* as master will synthesize DELs for us. */
- if (server.active_expire_enabled && server.masterhost == NULL) {
- activeExpireCycle(ACTIVE_EXPIRE_CYCLE_SLOW);
- } else if (server.masterhost != NULL) {
- expireSlaveKeys();
+ if (server.active_expire_enabled) {
+ if (server.masterhost == NULL) {
+ activeExpireCycle(ACTIVE_EXPIRE_CYCLE_SLOW);
+ } else {
+ expireSlaveKeys();
+ }
}
/* Defrag keys gradually. */