Commit 5e9fd22d authored by Andrey Veltischev's avatar Andrey Veltischev
Browse files

Remove endless sleep from aiohttp, run until complete cancelled tasks

parent f7e26736
......@@ -38,8 +38,6 @@ class AioAppWrapper:
await self.runner.setup()
site = web.TCPSite(self.runner, '', self.port)
await site.start()
while True:
await asyncio.sleep(3600)
def shutdown(self):'Shutdown aiohttp app')
......@@ -95,11 +93,14 @@ class ApplicationWrapper:
def run_all(self):
self.handle_signal(signal.SIGTERM, _raise_graceful_exit)
self.handle_signal(signal.SIGHUP, _raise_graceful_exit)
tasks = asyncio.gather(*[app.initialize() for app in self.apps])
try:'Start serving')
self.loop.run_until_complete(asyncio.gather(*[app.initialize() for app in self.apps]))
except KeyboardInterrupt:
for app in self.apps:
print('Stopping main wrapper')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment