From 68516b8fecf670daeb5d0d865c36599ca70de701 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 4 Aug 2004 06:19:31 +0000 Subject: [PATCH] Let's catch some socket.timeout action. --- plugins/RSS.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/RSS.py b/plugins/RSS.py index 3656eba1e..dcb15e0eb 100644 --- a/plugins/RSS.py +++ b/plugins/RSS.py @@ -206,6 +206,8 @@ class RSS(callbacks.Privmsg): self.locks[url].release() def getFeed(self, url): + def error(s): + return {'items': [{'title': s}]} try: # This is the most obvious place to acquire the lock, because a # malicious user could conceivably flood the bot with rss commands @@ -218,13 +220,15 @@ class RSS(callbacks.Privmsg): except sgmllib.SGMLParseError: self.log.exception('Uncaught exception from rssparser:') raise callbacks.Error, 'Invalid (unparseable) RSS feed.' + except socket.timeout: + return error('Timeout downloading feed.') self.cachedFeeds[url] = results self.lastRequest[url] = time.time() try: return self.cachedFeeds[url] except KeyError: self.lastRequest[url] = 0 - return {'items': [{'title': 'Unable to download feed.'}]} + return error('Unable to download feed.') finally: self.releaseLock(url)