From 2171072ae4519ed394fd2c556bf328cb1f23b603 Mon Sep 17 00:00:00 2001 From: ziajka Date: Thu, 26 Oct 2017 12:24:01 +0200 Subject: [PATCH 1/2] Enable debug mode on async loop only in dev/debug mode --- gns3server/web/web_server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index 40179367..51fbd691 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -35,7 +35,7 @@ from ..compute import MODULES from ..compute.port_manager import PortManager from ..compute.qemu import Qemu from ..controller import Controller - +from ..version import __version__ # do not delete this import import gns3server.handlers @@ -234,8 +234,11 @@ class WebServer: ssl_context = self._create_ssl_context(server_config) self._loop = asyncio.get_event_loop() - # Asyncio will raise error if coroutine is not called - self._loop.set_debug(True) + + if "dev" in __version__ or log.getEffectiveLevel() == logging.DEBUG: + # On dev/debug version we enable info that + # coroutine is not called in a way await/yield from + self._loop.set_debug(True) for key, val in os.environ.items(): log.debug("ENV %s=%s", key, val) From b2c5e175d710d8e690008bd37ad6e484509544d8 Mon Sep 17 00:00:00 2001 From: ziajka Date: Thu, 26 Oct 2017 13:37:50 +0200 Subject: [PATCH 2/2] Enable debug loop only on debug mode --- gns3server/web/web_server.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index 51fbd691..8352134f 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -35,7 +35,6 @@ from ..compute import MODULES from ..compute.port_manager import PortManager from ..compute.qemu import Qemu from ..controller import Controller -from ..version import __version__ # do not delete this import import gns3server.handlers @@ -235,8 +234,8 @@ class WebServer: self._loop = asyncio.get_event_loop() - if "dev" in __version__ or log.getEffectiveLevel() == logging.DEBUG: - # On dev/debug version we enable info that + if log.getEffectiveLevel() == logging.DEBUG: + # On debug version we enable info that # coroutine is not called in a way await/yield from self._loop.set_debug(True)