mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-26 21:11:12 -05:00
Make automatic announcement errors not: a) poll every time __call__ is called, b) respond with the errors.
This commit is contained in:
parent
4648360a04
commit
80c53dcea3
@ -141,6 +141,12 @@ class RSS(callbacks.Plugin):
|
|||||||
oldheadlines = []
|
oldheadlines = []
|
||||||
newresults = self.getFeed(url)
|
newresults = self.getFeed(url)
|
||||||
newheadlines = self.getHeadlines(newresults)
|
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):
|
def canonize(headline):
|
||||||
return (tuple(headline[0].lower().split()), headline[1])
|
return (tuple(headline[0].lower().split()), headline[1])
|
||||||
oldheadlines = set(map(canonize, oldheadlines))
|
oldheadlines = set(map(canonize, oldheadlines))
|
||||||
@ -217,7 +223,11 @@ class RSS(callbacks.Plugin):
|
|||||||
try:
|
try:
|
||||||
return self.cachedFeeds[url]
|
return self.cachedFeeds[url]
|
||||||
except KeyError:
|
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.')
|
return error('Unable to download feed.')
|
||||||
finally:
|
finally:
|
||||||
self.releaseLock(url)
|
self.releaseLock(url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user