From: phk Date: Sat, 23 Feb 2008 19:58:04 +0000 (+0000) Subject: Fix obj.last_use: We cannot use obj.lru_stamp, as that is only updated X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d1a496e6e89beb159b55e0c6e76e6ade2c59ba0;p=varnish Fix obj.last_use: We cannot use obj.lru_stamp, as that is only updated when we shuffle the LRU list. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2535 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 4c535fb2..c18a6b18 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -275,6 +275,7 @@ struct object { VTAILQ_HEAD(, esi_bit) esibits; double lru_stamp; + double last_use; /* Prefetch */ struct object *parent; diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 988f5cd5..fab7232c 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -151,8 +151,10 @@ cnt_deliver(struct sess *sp) CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); sp->t_resp = TIM_real(); - if (sp->obj->objhead != NULL) + if (sp->obj->objhead != NULL) { + sp->obj->last_use = sp->t_resp; /* XXX: locking ? */ EXP_Touch(sp->obj, sp->t_resp); + } RES_BuildHttp(sp); VCL_deliver_method(sp); switch (sp->handling) { diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 9534a80b..64c1a1a0 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -535,7 +535,7 @@ VRT_r_obj_lastuse(const struct sess *sp) CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */ - return (TIM_real() - sp->obj->lru_stamp); + return (TIM_real() - sp->obj->last_use); } int