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:
Randall Leeds 2013-08-06 02:46:21 -07:00
parent 33f7c96db6
commit 68b48b9694

View File

@ -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()