aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-07-13 15:02:07 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-07-13 15:02:07 +0200
commit02709a4c1e3074f75809997445bee2b1214fff51 (patch)
tree20f49678e34e3310fb0d9db265039d212ded3d3e /pyaggr3g470r
parentPerformance imporvement (loading of the management page). (diff)
downloadnewspipe-02709a4c1e3074f75809997445bee2b1214fff51.tar.gz
newspipe-02709a4c1e3074f75809997445bee2b1214fff51.tar.bz2
newspipe-02709a4c1e3074f75809997445bee2b1214fff51.zip
Performance improvement for the crawler (database insertion step).
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/crawler.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py
index 0f820373..c3978413 100644
--- a/pyaggr3g470r/crawler.py
+++ b/pyaggr3g470r/crawler.py
@@ -230,11 +230,11 @@ class FeedGetter(object):
"""
logger.info("Database insertion...")
new_articles = []
+ query1 = Article.query.filter(Article.user_id == self.user.id)
for feed, articles in elements:
+ query2 = query1.filter(Article.feed_id == feed.id)
for article in articles:
- exist = Article.query.filter(Article.user_id == self.user.id,
- Article.feed_id == feed.id,
- Article.link == article.link).count() != 0
+ exist = query2.filter(Article.link == article.link).count() != 0
if exist:
logger.debug("Article %r (%r) already in the database.",
article.title, article.link)
bgstack15