summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-05-10 12:39:35 +0200
committerGitHub <noreply@github.com>2019-05-10 12:39:35 +0200
commit34f6d9470105d5493871a30431a12deba658c8ef (patch)
tree9ce59f25e73a731ce3e8e168c934b71d01f38096
parent1e9b8d853d77c223418c5bd0f4cc48ef1e767bf5 (diff)
parent1c0913dc4e22701726b3a39386a17a83058ad24c (diff)
downloadredis-34f6d9470105d5493871a30431a12deba658c8ef.tar.gz
Merge pull request #6074 from trevor211/fixActiveExpire
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 9723fdbc1..4b87b6ac2 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1674,10 +1674,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. */