Fix issue with notification queue that prevented to properly close projects. Fix #1493

This commit is contained in:
grossmj
2019-01-12 16:02:36 +07:00
parent 161c05a310
commit a896346c77
4 changed files with 34 additions and 29 deletions

View File

@ -44,15 +44,17 @@ class NotificationHandler:
request.app['websockets'].add(ws)
asyncio.ensure_future(process_websocket(ws))
with notifications.queue() as queue:
try:
try:
with notifications.queue() as queue:
while True:
notification = await queue.get_json(1)
if ws.closed:
break
await ws.send_str(notification)
finally:
if not ws.closed:
await ws.close()
request.app['websockets'].discard(ws)
finally:
if not ws.closed:
await ws.close()
request.app['websockets'].discard(ws)
return ws