]> err.no Git - varnish/commitdiff
If we have more threads than the max, kill one if we can.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 11 Sep 2006 17:18:31 +0000 (17:18 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 11 Sep 2006 17:18:31 +0000 (17:18 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@968 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_pool.c

index 6d9a58acf8dcd051e39b511ef17f456ea2e97e8d..fcec8481ef6346db726e27c0c5a3dac605d8bbff 100644 (file)
@@ -269,7 +269,9 @@ wrk_reaperthread(void *priv)
                now = time(NULL);
                LOCK(&wrk_mtx);
                w = TAILQ_LAST(&wrk_idle, workerhead);
-               if (w != NULL && w->idle + params->wthread_timeout < now)
+               if (w != NULL &&
+                  (w->idle + params->wthread_timeout < now ||
+                   VSL_stats->n_wrk <= params->wthread_max)
                        TAILQ_REMOVE(&wrk_idle, w, list);
                else 
                        w = NULL;