From e619e013b68f47f36d9c2fa741af692f7b74b8d0 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Tue, 3 Jun 2014 15:57:12 -0700 Subject: [PATCH] sleep for 5 seconds after starting a browser, since starting 20 at once brings the computer to its knees --- umbra/controller.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/umbra/controller.py b/umbra/controller.py index c82d3ef..20316a6 100644 --- a/umbra/controller.py +++ b/umbra/controller.py @@ -106,11 +106,15 @@ class AmqpBrowserController: consumer.callbacks = [self._make_callback(browser)] conn.drain_events(timeout=0.5) consumer.callbacks = None + + # browser startup is a heavy operation, so do + # it once every 5 seconds at most + time.sleep(5) except KeyError: - # no browsers available + # thrown by self._browser_pool.acquire() - no browsers available time.sleep(0.5) except socket.timeout: - # no urls in the queue + # thrown by conn.drain_events(timeout=0.5) - no urls in the queue self._browser_pool.release(browser) except BaseException as e: