mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 15:33:49 +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:
|
||||
break
|
||||
|
||||
if project.auto_close and not controller.notification.project_has_listeners(project):
|
||||
yield from project.close()
|
||||
if project.auto_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(
|
||||
r"/projects/{project_id}/notifications/ws",
|
||||
@ -247,8 +251,12 @@ class ProjectHandler:
|
||||
break
|
||||
ws.send_str(notification)
|
||||
|
||||
if project.auto_close and not controller.notification.project_has_listeners(project):
|
||||
yield from project.close()
|
||||
if project.auto_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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user