From 09fca72b4ce86d871c2bbef70657105933e2a385 Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Fri, 2 Nov 2012 12:37:41 +0100 Subject: [PATCH] fixed spooler max tasks handling --- core/spooler.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/spooler.c b/core/spooler.c index f47100dc..923ade7d 100644 --- a/core/spooler.c +++ b/core/spooler.c @@ -355,12 +355,6 @@ void spooler(struct uwsgi_spooler *uspool) { } wakeup = tmp_wakeup; - // need to recycle ? - if (uwsgi.spooler_max_tasks > 0 && uspool->tasks >= (uint64_t)uwsgi.spooler_max_tasks) { - uwsgi_log("[spooler %s pid: %d] maximum number of tasks reached (%d) recycling ...\n", uspool->dir, (int) uwsgi.mypid, uwsgi.spooler_max_tasks); - end_me(0); - } - } } @@ -551,6 +545,14 @@ void spooler_manage_task(struct uwsgi_spooler *uspool, char *dir, char *task) { uwsgi_protected_close(spool_fd); uspool->running = 0; + + // need to recycle ? + if (uwsgi.spooler_max_tasks > 0 && uspool->tasks >= (uint64_t)uwsgi.spooler_max_tasks) { + uwsgi_log("[spooler %s pid: %d] maximum number of tasks reached (%d) recycling ...\n", uspool->dir, (int) uwsgi.mypid, uwsgi.spooler_max_tasks); + end_me(0); + } + + if (chdir(dir)) { uwsgi_error("chdir()"); uwsgi_log("[spooler] something horrible happened to the spooler. Better to kill it.\n");