better wakeup of workers

This commit is contained in:
roberto@debian32
2011-09-19 07:53:51 +02:00
parent a05f459b2b
commit 630054b72a
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -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;
+3
View File
@@ -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;