From b8412665862818765f6268cd76e9b27eb024c719 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 5 Mar 2015 07:52:46 +0100 Subject: Disable the feed when more than 2 erros (test). --- pyaggr3g470r/crawler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py index 66195124..ebcb8ce4 100644 --- a/pyaggr3g470r/crawler.py +++ b/pyaggr3g470r/crawler.py @@ -70,6 +70,9 @@ def parse_feed(user, feed): if data is None: feed.error_count += 1 + if feed.error_count > 2: + feed.enabled = False + db.session.commit() return a_feed = feedparser.parse(data) @@ -77,6 +80,8 @@ def parse_feed(user, feed): #logger.error(a_feed['bozo_exception']) feed.last_error = str(a_feed['bozo_exception']) feed.error_count += 1 + if feed.error_count > 2: + feed.enabled = False db.session.commit() if a_feed['entries'] == []: return -- cgit