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
@ -65,7 +65,7 @@ class Arbiter(object):
|
||||
self.init_signals()
|
||||
self.listen(self.address)
|
||||
log.info("Booted Arbiter: %s" % os.getpid())
|
||||
|
||||
|
||||
def init_signals(self):
|
||||
if self.PIPE:
|
||||
map(lambda p: p.close(), self.PIPE)
|
||||
@ -246,8 +246,9 @@ class Arbiter(object):
|
||||
continue
|
||||
|
||||
# Process Child
|
||||
worker_pid = os.getpid()
|
||||
try:
|
||||
log.info("Worker %s booting" % os.getpid())
|
||||
log.info("Worker %s booting" % worker_pid)
|
||||
worker.run()
|
||||
sys.exit(0)
|
||||
except SystemExit:
|
||||
@ -256,7 +257,8 @@ class Arbiter(object):
|
||||
log.exception("Exception in worker process.")
|
||||
sys.exit(-1)
|
||||
finally:
|
||||
log.info("Worker %s exiting." % os.getpid())
|
||||
worker.tmp.close()
|
||||
log.info("Worker %s exiting." % worker_pid)
|
||||
|
||||
def kill_workers(self, sig):
|
||||
for pid in self.WORKERS.keys():
|
||||
|
||||
@ -46,7 +46,6 @@ class Worker(object):
|
||||
)
|
||||
|
||||
def __init__(self, workerid, ppid, socket, app):
|
||||
|
||||
self.id = workerid
|
||||
self.ppid = ppid
|
||||
self.socket = socket
|
||||
@ -72,7 +71,7 @@ class Worker(object):
|
||||
spinner = 0
|
||||
while self.alive:
|
||||
spinner = (spinner+1) % 2
|
||||
os.fchmod(self.alive, spinner)
|
||||
os.fchmod(self.tmp.fileno(), spinner)
|
||||
|
||||
while self.alive:
|
||||
try:
|
||||
@ -105,7 +104,7 @@ class Worker(object):
|
||||
# Update the fd mtime on each client completion
|
||||
# to signal that this worker process is alive.
|
||||
spinner = (spinner+1) % 2
|
||||
os.fchmod(self.alive, spinner)
|
||||
os.fchmod(self.tmp.fileno(), spinner)
|
||||
|
||||
def handle(self, conn, client):
|
||||
req = http.HTTPRequest(conn, client, self.address)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user