mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-07-12 09:39:47 -04:00
client: Catch keyboard exceptions for the client tasks.
This commit is contained in:
parent
e766b1ae4b
commit
c8d81b9cf4
1 changed files with 13 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue