From 75c8e1c611ae57853dc1151e935d4596ca671d43 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 26 Jan 2019 10:46:57 +0100 Subject: controller: Make sure idleTimeout is always applied If the browser goes idle before we enter `while True` we never notice and thus the idleTimeout is never applied. --- crocoite/controller.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crocoite/controller.py b/crocoite/controller.py index d6f6d7a..e250cc5 100644 --- a/crocoite/controller.py +++ b/crocoite/controller.py @@ -161,7 +161,9 @@ class SinglePageController: # wait until the browser has a) been idle for at least # settings.idleTimeout or b) settings.timeout is exceeded timeoutProc = asyncio.ensure_future (asyncio.sleep (self.settings.timeout)) - idleTimeout = None + # the browser might have changed to idle from .navigate until here + # due to awaits inbetween. Thus, idleProc may never be triggered. + idleTimeout = None if not l.idle.get() else self.settings.idleTimeout while True: idleProc = asyncio.ensure_future (l.idle.wait ()) try: -- cgit v1.2.3