mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 23:43:48 +02:00
Use timemout for project auto close to avoid issue when client / connect
This commit is contained in:
parent
39db35c3ff
commit
8f7be87b1e
@ -213,8 +213,12 @@ class ProjectHandler:
|
|||||||
except asyncio.futures.CancelledError as e:
|
except asyncio.futures.CancelledError as e:
|
||||||
break
|
break
|
||||||
|
|
||||||
if project.auto_close and not controller.notification.project_has_listeners(project):
|
if project.auto_close:
|
||||||
yield from project.close()
|
# To avoid trouble with client connecting disconnecting we sleep few seconds before checking
|
||||||
|
# if someone else is not connected
|
||||||
|
yield from asyncio.sleep(5)
|
||||||
|
if not controller.notification.project_has_listeners(project):
|
||||||
|
yield from project.close()
|
||||||
|
|
||||||
@Route.get(
|
@Route.get(
|
||||||
r"/projects/{project_id}/notifications/ws",
|
r"/projects/{project_id}/notifications/ws",
|
||||||
@ -247,8 +251,12 @@ class ProjectHandler:
|
|||||||
break
|
break
|
||||||
ws.send_str(notification)
|
ws.send_str(notification)
|
||||||
|
|
||||||
if project.auto_close and not controller.notification.project_has_listeners(project):
|
if project.auto_close:
|
||||||
yield from project.close()
|
# To avoid trouble with client connecting disconnecting we sleep few seconds before checking
|
||||||
|
# if someone else is not connected
|
||||||
|
yield from asyncio.sleep(5)
|
||||||
|
if not controller.notification.project_has_listeners(project):
|
||||||
|
yield from project.close()
|
||||||
|
|
||||||
return ws
|
return ws
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user