mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2024-12-17 20:04:34 -05:00
client: Catch keyboard exceptions for the client tasks.
This commit is contained in:
parent
e766b1ae4b
commit
c8d81b9cf4
@ -279,7 +279,7 @@ class PanClient(AsyncClient):
|
||||
|
||||
await self.index.commit_events()
|
||||
self.delete_fetcher_task(fetch_task)
|
||||
except (asyncio.CancelledError, KeyboardInterrupt):
|
||||
except asyncio.CancelledError:
|
||||
return
|
||||
|
||||
async def sync_tasks(self, response):
|
||||
@ -585,12 +585,22 @@ class PanClient(AsyncClient):
|
||||
|
||||
if self.task and not self.task.done():
|
||||
self.task.cancel()
|
||||
|
||||
try:
|
||||
await self.task
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
self.task = None
|
||||
|
||||
if self.history_fetcher_task and not self.history_fetcher_task.done():
|
||||
self.history_fetcher_task.cancel()
|
||||
|
||||
try:
|
||||
await self.history_fetcher_task
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
self.history_fetcher_task = None
|
||||
|
||||
self.history_fetch_queue = asyncio.Queue()
|
||||
|
Loading…
Reference in New Issue
Block a user