From 4befe73b60f7e02dd304ea0c19febce8fea0bd13 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 6 Aug 2013 12:59:04 +0200 Subject: [PATCH] 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. --- src/redis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis.c b/src/redis.c index d1dde4d1..c1f1d664 100644 --- a/src/redis.c +++ b/src/redis.c @@ -721,7 +721,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; }