]> err.no Git - varnish/commitdiff
Always update stats in wrk_decimate_flock
authortfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 16 Sep 2008 07:30:33 +0000 (07:30 +0000)
committertfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 16 Sep 2008 07:30:33 +0000 (07:30 +0000)
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

index 965c35f973e830eb55c9d64447e4f684f29924d6..cf1f248985a216298c806de0ae325fe911be9e94 100644 (file)
@@ -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... */