Add extra checking for additional requests made while we were in the process of stopping reactor, change from callLater to deferLater to be compliant with inlinecallbacks.
This commit is contained in:
parent
4b5ee77292
commit
96ab620618
1 changed files with 9 additions and 2 deletions
|
|
@ -397,6 +397,13 @@ class Evennia(object):
|
||||||
# this will also send a reactor.stop signal, so we set a
|
# this will also send a reactor.stop signal, so we set a
|
||||||
# flag to avoid loops.
|
# flag to avoid loops.
|
||||||
self.shutdown_complete = True
|
self.shutdown_complete = True
|
||||||
|
if WEBSERVER_ENABLED:
|
||||||
|
# Just to be extra sure, get all pending requests that might have occurred after we started
|
||||||
|
d = self.web_root.get_pending_requests()
|
||||||
|
d.addCallback(lambda _: reactor.stop())
|
||||||
|
from twisted.internet import task
|
||||||
|
yield task.deferLater(reactor, 1, d.callback, None)
|
||||||
|
else:
|
||||||
# kill the server
|
# kill the server
|
||||||
reactor.callLater(1, reactor.stop)
|
reactor.callLater(1, reactor.stop)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue