From 0cc0e87d3f3bafba6a22c883cdf24e9962fafe37 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 10 Mar 2015 09:25:10 +0100 Subject: failover for bad counter manipulation --- pyaggr3g470r/lib/crawler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pyaggr3g470r/lib') diff --git a/pyaggr3g470r/lib/crawler.py b/pyaggr3g470r/lib/crawler.py index 8e61b7cf..9df37993 100644 --- a/pyaggr3g470r/lib/crawler.py +++ b/pyaggr3g470r/lib/crawler.py @@ -107,11 +107,17 @@ class AbstractCrawler: 'User-Agent': 'pyaggr3g470r'}) @classmethod - def wait(cls): + def wait(cls, max_wait=600): "See count_on_me, that method will just wait for the counter to be 0" time.sleep(1) + second_waited = 1 while cls.__counter__: + if second_waited > max_wait: + logger.warn('Exiting after %d seconds, counter at %d', + max_wait, cls.__counter__) + break time.sleep(1) + second_waited += 1 class PyAggUpdater(AbstractCrawler): -- cgit