From e497e350032d1707ac56769a11e75912ade7907a Mon Sep 17 00:00:00 2001 From: tfheen Date: Tue, 16 Sep 2008 07:30:33 +0000 Subject: [PATCH] Always update stats in wrk_decimate_flock Make sure to update the stats even if we don't kill off any excess threads. Fixes #308 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3188 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_pool.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 965c35f9..cf1f2489 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -431,21 +431,19 @@ wrk_addpools(const unsigned pools) static void wrk_decimate_flock(struct wq *qp, double t_idle, struct varnish_stats *vs) { - struct worker *w; - - if (qp->nthr <= params->wthread_min) - return; + struct worker *w = NULL; LOCK(&qp->mtx); - w = VTAILQ_LAST(&qp->idle, workerhead); - if (w != NULL && (w->lastused < t_idle || qp->nthr > nthr_max)) - VTAILQ_REMOVE(&qp->idle, w, list); - else - w = NULL; vs->n_wrk += qp->nthr; vs->n_wrk_queue += qp->nqueue; vs->n_wrk_drop += qp->ndrop; vs->n_wrk_overflow += qp->noverflow; + + if (qp->nthr > params->wthread_min) { + w = VTAILQ_LAST(&qp->idle, workerhead); + if (w != NULL && (w->lastused < t_idle || qp->nthr > nthr_max)) + VTAILQ_REMOVE(&qp->idle, w, list); + } UNLOCK(&qp->mtx); /* And give it a kiss on the cheek... */ -- 2.39.5