chg: Catch aiohttp.ClientError
parent
76ec7ff379
commit
9904404003
|
@ -133,6 +133,7 @@ class Fetcher():
|
||||||
if not await self.__newer():
|
if not await self.__newer():
|
||||||
unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
|
unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(self.url) as r:
|
async with session.get(self.url) as r:
|
||||||
content = await r.content.read()
|
content = await r.content.read()
|
||||||
|
@ -142,6 +143,8 @@ class Fetcher():
|
||||||
with (self.directory / '{}.txt'.format(datetime.now().isoformat())).open('wb') as f:
|
with (self.directory / '{}.txt'.format(datetime.now().isoformat())).open('wb') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
|
unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
|
||||||
|
except aiohttp.ClientError as e:
|
||||||
|
self.logger.exception('Fetching the list failed: {}'.format(e))
|
||||||
except PidFileError:
|
except PidFileError:
|
||||||
self.logger.info('Fetcher already running')
|
self.logger.info('Fetcher already running')
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue