News download: Retry article download if temporary failure in DNS

This commit is contained in:
Kovid Goyal 2010-04-15 19:18:43 +05:30
parent f4f6d4d728
commit a031f04e91

View File

@ -212,7 +212,8 @@ class RecursiveFetcher(object):
if hasattr(err, 'code') and responses.has_key(err.code):
raise FetchError, responses[err.code]
if getattr(err, 'reason', [0])[0] == 104 or \
getattr(getattr(err, 'args', [None])[0], 'errno', None) == -2: # Connection reset by peer or Name or service not know
getattr(getattr(err, 'args', [None])[0], 'errno', None) in (-2,
-3): # Connection reset by peer or Name or service not know
self.log.debug('Temporary error, retrying in 1 second')
time.sleep(1)
with closing(open_func(url, timeout=self.timeout)) as f: