summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuYunlong <xzsyeb@126.com>2019-05-06 11:46:07 +0800
committerWuYunlong <xzsyeb@126.com>2019-05-06 11:46:07 +0800
commit1c0913dc4e22701726b3a39386a17a83058ad24c (patch)
treef29bddd19cc12ef3bc1a2fe425bf4036a04c705d
parent0a6090bfd8fbec26f682ff0a1dc7a43699e0c9b7 (diff)
downloadredis-1c0913dc4e22701726b3a39386a17a83058ad24c.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 fb5d679cd..eaa7172a7 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. */