mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
self.alive is'nt anymore a file descriptor
This commit is contained in:
parent
004f441d59
commit
7cf859a5c0
@ -246,8 +246,9 @@ class Arbiter(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Process Child
|
# Process Child
|
||||||
|
worker_pid = os.getpid()
|
||||||
try:
|
try:
|
||||||
log.info("Worker %s booting" % os.getpid())
|
log.info("Worker %s booting" % worker_pid)
|
||||||
worker.run()
|
worker.run()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
@ -256,7 +257,8 @@ class Arbiter(object):
|
|||||||
log.exception("Exception in worker process.")
|
log.exception("Exception in worker process.")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
finally:
|
finally:
|
||||||
log.info("Worker %s exiting." % os.getpid())
|
worker.tmp.close()
|
||||||
|
log.info("Worker %s exiting." % worker_pid)
|
||||||
|
|
||||||
def kill_workers(self, sig):
|
def kill_workers(self, sig):
|
||||||
for pid in self.WORKERS.keys():
|
for pid in self.WORKERS.keys():
|
||||||
|
|||||||
@ -46,7 +46,6 @@ class Worker(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, workerid, ppid, socket, app):
|
def __init__(self, workerid, ppid, socket, app):
|
||||||
|
|
||||||
self.id = workerid
|
self.id = workerid
|
||||||
self.ppid = ppid
|
self.ppid = ppid
|
||||||
self.socket = socket
|
self.socket = socket
|
||||||
@ -72,7 +71,7 @@ class Worker(object):
|
|||||||
spinner = 0
|
spinner = 0
|
||||||
while self.alive:
|
while self.alive:
|
||||||
spinner = (spinner+1) % 2
|
spinner = (spinner+1) % 2
|
||||||
os.fchmod(self.alive, spinner)
|
os.fchmod(self.tmp.fileno(), spinner)
|
||||||
|
|
||||||
while self.alive:
|
while self.alive:
|
||||||
try:
|
try:
|
||||||
@ -105,7 +104,7 @@ class Worker(object):
|
|||||||
# Update the fd mtime on each client completion
|
# Update the fd mtime on each client completion
|
||||||
# to signal that this worker process is alive.
|
# to signal that this worker process is alive.
|
||||||
spinner = (spinner+1) % 2
|
spinner = (spinner+1) % 2
|
||||||
os.fchmod(self.alive, spinner)
|
os.fchmod(self.tmp.fileno(), spinner)
|
||||||
|
|
||||||
def handle(self, conn, client):
|
def handle(self, conn, client):
|
||||||
req = http.HTTPRequest(conn, client, self.address)
|
req = http.HTTPRequest(conn, client, self.address)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user