mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Forward-compatibility for gevent graceful shutdown
This commit closes the loop on fd6c712. Aforementioned commit fixed observable problems in my testing with gevent 1.0 release candidates but the explanation given at the time was curiously bogus. It came from a misreading of pools and servers as used in the ggevent worker. With this change, both versions of gevent should support graceful and non-graceful shutdown.
This commit is contained in:
parent
33f7c96db6
commit
68b48b9694
@ -97,7 +97,11 @@ class GeventWorker(AsyncWorker):
|
||||
|
||||
try:
|
||||
# Stop accepting requests
|
||||
[server.stop_accepting() for server in servers]
|
||||
for server in servers:
|
||||
if hasattr(server, 'close'): # gevent 1.0
|
||||
server.close()
|
||||
if hasattr(server, 'kill'): # gevent < 1.0
|
||||
server.kill()
|
||||
|
||||
# Handle current requests until graceful_timeout
|
||||
ts = time.time()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user