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