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()
|
await self.index.commit_events()
|
||||||
self.delete_fetcher_task(fetch_task)
|
self.delete_fetcher_task(fetch_task)
|
||||||
except (asyncio.CancelledError, KeyboardInterrupt):
|
except asyncio.CancelledError:
|
||||||
return
|
return
|
||||||
|
|
||||||
async def sync_tasks(self, response):
|
async def sync_tasks(self, response):
|
||||||
@ -585,12 +585,22 @@ class PanClient(AsyncClient):
|
|||||||
|
|
||||||
if self.task and not self.task.done():
|
if self.task and not self.task.done():
|
||||||
self.task.cancel()
|
self.task.cancel()
|
||||||
|
|
||||||
|
try:
|
||||||
await self.task
|
await self.task
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
self.task = None
|
self.task = None
|
||||||
|
|
||||||
if self.history_fetcher_task and not self.history_fetcher_task.done():
|
if self.history_fetcher_task and not self.history_fetcher_task.done():
|
||||||
self.history_fetcher_task.cancel()
|
self.history_fetcher_task.cancel()
|
||||||
|
|
||||||
|
try:
|
||||||
await self.history_fetcher_task
|
await self.history_fetcher_task
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
self.history_fetcher_task = None
|
self.history_fetcher_task = None
|
||||||
|
|
||||||
self.history_fetch_queue = asyncio.Queue()
|
self.history_fetch_queue = asyncio.Queue()
|
||||||
|
Loading…
Reference in New Issue
Block a user