Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unblock the wait loop under python 3.5 #1257

Merged
merged 1 commit into from May 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions gunicorn/workers/base.py
Expand Up @@ -113,6 +113,8 @@ def changed(fname):
[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()
Expand Down Expand Up @@ -164,6 +166,9 @@ def init_signals(self):
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()

Expand Down
5 changes: 4 additions & 1 deletion gunicorn/workers/sync.py
Expand Up @@ -32,7 +32,7 @@ def accept(self, listener):
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]

Expand Down Expand Up @@ -93,6 +93,9 @@ def run_for_multiple(self, timeout):

if ready is not None:
for listener in ready:
if listener == self.PIPE[0]:
continue

try:
self.accept(listener)
except EnvironmentError as e:
Expand Down