mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
[eventlet] handle QUIT in a new coroutine
Just like in the gevent worker, a blocking call should only be executed from within a coroutine. The AssertionError around the main loop of the eventlet worker can be removed, since it was there to catch the exception raised by the sleep.
This commit is contained in:
parent
e05941cec2
commit
c6387b3031
@ -94,6 +94,9 @@ class EventletWorker(AsyncWorker):
|
|||||||
self.patch()
|
self.patch()
|
||||||
super(EventletWorker, self).init_process()
|
super(EventletWorker, self).init_process()
|
||||||
|
|
||||||
|
def handle_quit(self, sig, frame):
|
||||||
|
eventlet.spawn(super(EventletWorker, self).handle_quit, sig, frame)
|
||||||
|
|
||||||
def timeout_ctx(self):
|
def timeout_ctx(self):
|
||||||
return eventlet.Timeout(self.cfg.keepalive or None, False)
|
return eventlet.Timeout(self.cfg.keepalive or None, False)
|
||||||
|
|
||||||
@ -118,11 +121,7 @@ class EventletWorker(AsyncWorker):
|
|||||||
|
|
||||||
while self.alive:
|
while self.alive:
|
||||||
self.notify()
|
self.notify()
|
||||||
try:
|
eventlet.sleep(1.0)
|
||||||
eventlet.sleep(1.0)
|
|
||||||
except AssertionError:
|
|
||||||
self.alive = False
|
|
||||||
break
|
|
||||||
|
|
||||||
self.notify()
|
self.notify()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user