mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #1257 from benoitc/fix/1256
unblock the wait loop under python 3.5
This commit is contained in:
commit
58f190d346
@ -113,6 +113,8 @@ class Worker(object):
|
||||
[util.close_on_exec(s) for s in self.sockets]
|
||||
util.close_on_exec(self.tmp.fileno())
|
||||
|
||||
self.wait_fds = self.sockets + [self.PIPE[0]]
|
||||
|
||||
self.log.close_on_exec()
|
||||
|
||||
self.init_signals()
|
||||
@ -164,6 +166,9 @@ class Worker(object):
|
||||
signal.siginterrupt(signal.SIGTERM, False)
|
||||
signal.siginterrupt(signal.SIGUSR1, False)
|
||||
|
||||
if hasattr(signal, 'set_wakeup_fd'):
|
||||
signal.set_wakeup_fd(self.PIPE[1])
|
||||
|
||||
def handle_usr1(self, sig, frame):
|
||||
self.log.reopen_files()
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class SyncWorker(base.Worker):
|
||||
def wait(self, timeout):
|
||||
try:
|
||||
self.notify()
|
||||
ret = select.select(self.sockets, [], self.PIPE, timeout)
|
||||
ret = select.select(self.wait_fds, [], [], timeout)
|
||||
if ret[0]:
|
||||
return ret[0]
|
||||
|
||||
@ -93,6 +93,9 @@ class SyncWorker(base.Worker):
|
||||
|
||||
if ready is not None:
|
||||
for listener in ready:
|
||||
if listener == self.PIPE[0]:
|
||||
continue
|
||||
|
||||
try:
|
||||
self.accept(listener)
|
||||
except EnvironmentError as e:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user