diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-07-13 15:02:07 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-07-13 15:02:07 +0200 |
commit | 02709a4c1e3074f75809997445bee2b1214fff51 (patch) | |
tree | 20f49678e34e3310fb0d9db265039d212ded3d3e | |
parent | Performance imporvement (loading of the management page). (diff) | |
download | newspipe-02709a4c1e3074f75809997445bee2b1214fff51.tar.gz newspipe-02709a4c1e3074f75809997445bee2b1214fff51.tar.bz2 newspipe-02709a4c1e3074f75809997445bee2b1214fff51.zip |
Performance improvement for the crawler (database insertion step).
-rw-r--r-- | pyaggr3g470r/crawler.py | 6 |
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) |