Commit 6a5987ec authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

If we have more threads than the max, kill one if we can.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@968 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e5342dbf
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment