r3188 - trunk/varnish-cache/bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Tue Sep 16 09:30:33 CEST 2008


Author: tfheen
Date: 2008-09-16 09:30:33 +0200 (Tue, 16 Sep 2008)
New Revision: 3188

Modified:
   trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
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


Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2008-09-16 07:30:30 UTC (rev 3187)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2008-09-16 07:30:33 UTC (rev 3188)
@@ -431,21 +431,19 @@
 static void
 wrk_decimate_flock(struct wq *qp, double t_idle, struct varnish_stats *vs)
 {
-	struct worker *w;
+	struct worker *w = NULL;
 
-	if (qp->nthr <= params->wthread_min)
-		return;
-
 	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... */




More information about the varnish-commit mailing list