From 630054b72ad04fdaaa9466a411a9e713ff4e8d7c Mon Sep 17 00:00:00 2001 From: "roberto@debian32" Date: Mon, 19 Sep 2011 07:53:51 +0200 Subject: [PATCH] better wakeup of workers --- master.c | 2 +- master_utils.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/master.c b/master.c index 94e9af4b..1fadb00a 100644 --- a/master.c +++ b/master.c @@ -615,7 +615,7 @@ healthy: time_t oldest_worker_spawn = LONG_MAX; int oldest_worker = 0; for(i=1;i<=uwsgi.numproc;i++) { - if (uwsgi.workers[i].cheaped == 0) { + if (uwsgi.workers[i].cheaped == 0 && uwsgi.workers[i].pid > 0) { if (uwsgi.workers[i].last_spawn < oldest_worker_spawn) { oldest_worker_spawn = uwsgi.workers[i].last_spawn; oldest_worker = i; diff --git a/master_utils.c b/master_utils.c index a4b833b2..a54ea8f4 100644 --- a/master_utils.c +++ b/master_utils.c @@ -2,6 +2,8 @@ extern struct uwsgi_server uwsgi; +void worker_wakeup() {} + void master_check_cluster_nodes() { int i; @@ -49,6 +51,7 @@ int uwsgi_respawn_worker(int wid) { pid_t pid = fork(); if (pid == 0) { + signal(SIGWINCH, worker_wakeup); uwsgi.mywid = wid; uwsgi.mypid = getpid(); uwsgi.workers[uwsgi.mywid].pid = uwsgi.mypid;