Only reset the cached feed when the response actually contains headlines

Some feeds, such as those from sourceforge.net, will sometimes show an error
page rather than a feed. In this case the feed cache used to be cleared for
that feed, causing all 'old' headlines to be flooded to the channel as soon
as the feed came back online.

This patch hopefully fixes that by only resetting the cache when the returned
page actually contains headlines.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
Arnout Engelen 2012-05-04 10:26:09 +02:00 committed by James McCoy
parent 333067c151
commit 58e7e61d69

View File

@ -236,7 +236,7 @@ class RSS(callbacks.Plugin):
# These seem mostly harmless. We'll need reports of a
# kind that isn't.
self.log.debug('Allowing bozo_exception %r through.', e)
if results.get('feed', {}):
if results.get('feed', {}) and self.getHeadlines(results):
self.cachedFeeds[url] = results
self.lastRequest[url] = time.time()
else: