signal handlers cant call async functions
This commit is contained in:
parent
2cb9d5c636
commit
3e4c9f25a8
1 changed files with 2 additions and 2 deletions
|
@ -117,8 +117,8 @@ class Server:
|
|||
def run(self):
|
||||
loop = asyncio.get_event_loop()
|
||||
try:
|
||||
loop.add_signal_handler(signal.SIGINT, self.stop)
|
||||
loop.add_signal_handler(signal.SIGTERM, self.stop)
|
||||
loop.add_signal_handler(signal.SIGINT, lambda: asyncio.ensure_future(self.stop()))
|
||||
loop.add_signal_handler(signal.SIGTERM, lambda: asyncio.ensure_future(self.stop()))
|
||||
loop.run_until_complete(self.start())
|
||||
loop.run_until_complete(self.shutdown_event.wait())
|
||||
finally:
|
||||
|
|
Loading…
Reference in a new issue