~cedric/pyAggr3g470r

d119bf7a5bc33e6419b0f9b2e06ede5ad8ab4704 — Fran├žois Schmidts 8 years ago 4fff9ae
limiting the feed editing request by removing the dull updating of etag and last modified of no meaning
1 files changed, 12 insertions(+), 8 deletions(-)

M pyaggr3g470r/lib/crawler.py
M pyaggr3g470r/lib/crawler.py => pyaggr3g470r/lib/crawler.py +12 -8
@@ 121,14 121,18 @@ class PyAggUpdater(AbstractCrawler):
            up_feed['last_retrieved'] \
                    = (datetime.now() - timedelta(minutes=45)).isoformat()

        if any([up_feed[key] != self.feed.get(key) for key in up_feed]):
            logger.warn('%r %r - pushing feed attrs %r',
                    self.feed['id'], self.feed['title'],
                    {key: "%s -> %s" % (up_feed[key], self.feed.get(key))
                     for key in up_feed if up_feed[key] != self.feed.get(key)})

            future = self.query_pyagg('put',
                    'feed/%d' % self.feed['id'], up_feed)
        diff_keys = {key for key in up_feed
                     if up_feed[key] != self.feed.get(key)}
        if not diff_keys:
            return  # no change in the feed, no update
        if not article_created and diff_keys == {'last_modified', 'etag'}:
            return  # meaningless if no new article has been published
        logger.info('%r %r - pushing feed attrs %r',
                self.feed['id'], self.feed['title'],
                {key: "%s -> %s" % (up_feed[key], self.feed.get(key))
                 for key in up_feed if up_feed[key] != self.feed.get(key)})

        future = self.query_pyagg('put', 'feed/%d' % self.feed['id'], up_feed)


class FeedCrawler(AbstractCrawler):