summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-08-06 12:59:04 +0200
committerantirez <antirez@gmail.com>2013-08-07 11:37:38 +0200
commit2e4ec793132148ebe4e30ed76d39536b9a26727f (patch)
tree64c8e52676ef383d6aa057f9615272156f7d666a
parent1bcf296cf9c82a4b65a9b0ff2599dd36a32e4272 (diff)
downloadredis-2e4ec793132148ebe4e30ed76d39536b9a26727f.tar.gz
activeExpireCycle(): fix about fast cycle early start.
We don't want to repeat a fast cycle too soon, the previous code was broken, we need to wait two times the period *since* the start of the previous cycle in order to avoid there is an even space between cycles: .-> start .-> second start | | +-------------+-------------+--------------+ | first cycle | pause | second cycle | +-------------+-------------+--------------+ The second and first start must be PERIOD*2 useconds apart hence the *2 in the new code.
-rw-r--r--src/redis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis.c b/src/redis.c
index 3e8a48aa1..15a3e8e0d 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -678,7 +678,7 @@ void activeExpireCycle(int type) {
* for time limt. Also don't repeat a fast cycle for the same period
* as the fast cycle total duration itself. */
if (!timelimit_exit) return;
- if (start < last_fast_cycle + ACTIVE_EXPIRE_CYCLE_FAST_DURATION) return;
+ if (start < last_fast_cycle + ACTIVE_EXPIRE_CYCLE_FAST_DURATION*2) return;
last_fast_cycle = start;
}