From b82991172968e665fa5882742148a675cf880135 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 30 Oct 2018 16:47:04 +0100 Subject: Reduce idle wait time after stopping page --- crocoite/controller.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crocoite/controller.py b/crocoite/controller.py index b1f5f6f..dd39c1d 100644 --- a/crocoite/controller.py +++ b/crocoite/controller.py @@ -135,7 +135,7 @@ class SinglePageController: def run (self): logger = self.logger - def processQueue (): + def processQueue (idleTimeout=self.settings.idleTimeout): # XXX: this is very ugly code and does not work well. figure out a # better way to impose timeouts and still process all items in the # queue @@ -146,7 +146,7 @@ class SinglePageController: while True: now = time.time () elapsed = now-start - maxTimeout = max (min (self.settings.idleTimeout, self.settings.timeout-elapsed), 0) + maxTimeout = max (min (idleTimeout, self.settings.timeout-elapsed), 0) logger.debug ('timeout status', uuid='49550447-37e3-49ff-9a73-34da1c3e5984', maxTimeout=maxTimeout, elapsed=elapsed) @@ -219,13 +219,13 @@ class SinglePageController: self.processItem (item) # if we stopped due to timeout, wait for remaining assets - processQueue () + processQueue (1) for b in enabledBehavior: for item in b.onfinish (): self.processItem (item) - processQueue () + processQueue (1) class RecursionPolicy: """ Abstract recursion policy """ -- cgit v1.2.3