aboutsummaryrefslogtreecommitdiff
path: root/src/crawler/classic_crawler.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-10 07:54:50 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-10 07:54:50 +0100
commita55fab48c46a7e358ec1506ca6a407f3428ca489 (patch)
tree24d1d7c2347d90247282d5facbbdf8a07eb7ebf8 /src/crawler/classic_crawler.py
parentSet the initial value of the reduce. (diff)
downloadnewspipe-a55fab48c46a7e358ec1506ca6a407f3428ca489.tar.gz
newspipe-a55fab48c46a7e358ec1506ca6a407f3428ca489.tar.bz2
newspipe-a55fab48c46a7e358ec1506ca6a407f3428ca489.zip
It is now possible to configure the refresh interval of feeds (in minutes).
Diffstat (limited to 'src/crawler/classic_crawler.py')
-rw-r--r--src/crawler/classic_crawler.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/crawler/classic_crawler.py b/src/crawler/classic_crawler.py
index 7d29d462..eb75b78f 100644
--- a/src/crawler/classic_crawler.py
+++ b/src/crawler/classic_crawler.py
@@ -30,7 +30,7 @@ import asyncio
import logging
import feedparser
import dateutil.parser
-from datetime import datetime, timezone
+from datetime import datetime, timezone, timedelta
from sqlalchemy import or_
import conf
@@ -184,9 +184,12 @@ def retrieve_feed(loop, user, feed_id=None):
filters['id'] = feed_id
filters['enabled'] = True
filters['error_count__lt'] = conf.DEFAULT_MAX_ERROR
+ filters['last_retrieved__lt'] = datetime.now() - \
+ timedelta(minutes=conf.FEED_REFRESH_INTERVAL)
feeds = FeedController().read(**filters).all()
if feeds == []:
+ logger.info('No feed to retrieve for {}'.format(user.nickname))
return
# Launch the process for all the feeds
bgstack15