[master] 3e087be Kill objects on "ttl + max(grace, keep)" rather than "ttl + grace + keep"

Poul-Henning Kamp phk at varnish-cache.org
Mon Mar 14 11:21:26 CET 2011


commit 3e087be3c7fd588a88235bee1998df7c132a4bea
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 14 10:21:02 2011 +0000

    Kill objects on "ttl + max(grace,keep)" rather than "ttl + grace + keep"

diff --git a/bin/varnishd/cache_expire.c b/bin/varnishd/cache_expire.c
index f71a630..ec6ff66 100644
--- a/bin/varnishd/cache_expire.c
+++ b/bin/varnishd/cache_expire.c
@@ -110,7 +110,7 @@ EXP_Keep(const struct sess *sp, const struct object *o)
 		r = o->exp.keep;
 	if (sp != NULL && sp->exp.keep > 0. && sp->exp.keep < r)
 		r = sp->exp.keep;
-	return (EXP_Grace(sp, o) + r);
+	return (EXP_Ttl(sp, o) + r);
 }
 
 double
@@ -145,7 +145,7 @@ static int
 update_object_when(const struct object *o)
 {
 	struct objcore *oc;
-	double when;
+	double when, w2;
 
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 	oc = o->objcore;
@@ -153,6 +153,9 @@ update_object_when(const struct object *o)
 	Lck_AssertHeld(&exp_mtx);
 
 	when = EXP_Keep(NULL, o);
+	w2 = EXP_Grace(NULL, o);
+	if (w2 > when)
+		when = w2;
 	assert(!isnan(when));
 	if (when == oc->timer_when)
 		return (0);



More information about the varnish-commit mailing list