From 80c53dcea339b561c577602802363d54d68f02d0 Mon Sep 17 00:00:00 2001 From: James Vega Date: Fri, 25 Feb 2005 00:04:39 +0000 Subject: [PATCH] Make automatic announcement errors not: a) poll every time __call__ is called, b) respond with the errors. --- plugins/RSS/plugin.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index 7f5de7338..3cdc74720 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -141,6 +141,12 @@ class RSS(callbacks.Plugin): oldheadlines = [] newresults = self.getFeed(url) newheadlines = self.getHeadlines(newresults) + if len(newheadlines) == 1: + s = newheadlines[0][0] + if s in ('Timeout downloading feed.', + 'Unable to download feed.'): + self.log.debug('%s %u', s, url) + return def canonize(headline): return (tuple(headline[0].lower().split()), headline[1]) oldheadlines = set(map(canonize, oldheadlines)) @@ -217,7 +223,11 @@ class RSS(callbacks.Plugin): try: return self.cachedFeeds[url] except KeyError: - self.lastRequest[url] = 0 + wait = self.registryValue('waitPeriod') + # If there's a problem retrieving the feed, we should back off + # for a little bit before retrying so that there is time for + # the error to be resolved. + self.lastRequest[url] = time.time() - .5 * wait return error('Unable to download feed.') finally: self.releaseLock(url)