diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2019-01-26 10:46:57 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2019-01-26 10:46:57 +0100 |
commit | 75c8e1c611ae57853dc1151e935d4596ca671d43 (patch) | |
tree | 0c63a65b2e45013fa01b8f551edf57f3dfd3879b /crocoite | |
parent | e16a6b458ffcf4b9c436959e8a855245575d499c (diff) | |
download | crocoite-75c8e1c611ae57853dc1151e935d4596ca671d43.tar.gz crocoite-75c8e1c611ae57853dc1151e935d4596ca671d43.tar.bz2 crocoite-75c8e1c611ae57853dc1151e935d4596ca671d43.zip |
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.
Diffstat (limited to 'crocoite')
-rw-r--r-- | crocoite/controller.py | 4 |
1 files changed, 3 insertions, 1 deletions
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: |