Have task coros handle cancelled exceptions
This commit is contained in:
parent
a2280bbc93
commit
db187540d5
@ -91,6 +91,8 @@ class Prefetcher(LoggedClass):
|
|||||||
await asyncio.sleep(0)
|
await asyncio.sleep(0)
|
||||||
except DaemonError as e:
|
except DaemonError as e:
|
||||||
self.logger.info('ignoring daemon error: {}'.format(e))
|
self.logger.info('ignoring daemon error: {}'.format(e))
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
break
|
||||||
|
|
||||||
async def _caught_up(self):
|
async def _caught_up(self):
|
||||||
'''Poll for new blocks and mempool state.
|
'''Poll for new blocks and mempool state.
|
||||||
|
|||||||
@ -51,6 +51,12 @@ class IRC(LoggedClass):
|
|||||||
self.peers = {}
|
self.peers = {}
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
|
try:
|
||||||
|
await self.join()
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def join(self):
|
||||||
import irc.client as irc_client
|
import irc.client as irc_client
|
||||||
|
|
||||||
self.logger.info('joining IRC with nick "{}" and real name "{}"'
|
self.logger.info('joining IRC with nick "{}" and real name "{}"'
|
||||||
|
|||||||
@ -235,8 +235,10 @@ class Session(JSONRPC):
|
|||||||
secs = time.time() - start
|
secs = time.time() - start
|
||||||
if secs > 1:
|
if secs > 1:
|
||||||
self.logger.warning('slow request for {} took {:.1f}s: {}'
|
self.logger.warning('slow request for {} took {:.1f}s: {}'
|
||||||
.format(session.peername(), secs,
|
.format(self.peername(), secs,
|
||||||
request))
|
request))
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
# Getting here should probably be considered a bug and fixed
|
# Getting here should probably be considered a bug and fixed
|
||||||
self.logger.error('error handling request {}'.format(request))
|
self.logger.error('error handling request {}'.format(request))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user