diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-05 07:52:46 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-05 07:52:46 +0100 |
commit | b8412665862818765f6268cd76e9b27eb024c719 (patch) | |
tree | 54de301f9d66179f3df988d0c9f785d03c8990cd | |
parent | Typo (diff) | |
download | newspipe-b8412665862818765f6268cd76e9b27eb024c719.tar.gz newspipe-b8412665862818765f6268cd76e9b27eb024c719.tar.bz2 newspipe-b8412665862818765f6268cd76e9b27eb024c719.zip |
Disable the feed when more than 2 erros (test).
-rw-r--r-- | pyaggr3g470r/crawler.py | 5 |
1 files changed, 5 insertions, 0 deletions
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 |