mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-09 22:49:32 -05:00
client: Handle server disconnect exceptions.
This commit is contained in:
parent
5f124806d8
commit
2c218bfd04
@ -2,7 +2,8 @@ import asyncio
|
|||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from aiohttp.client_exceptions import ClientProxyConnectionError
|
from aiohttp.client_exceptions import (ClientProxyConnectionError,
|
||||||
|
ServerDisconnectedError)
|
||||||
from nio import (AsyncClient, ClientConfig, EncryptionError,
|
from nio import (AsyncClient, ClientConfig, EncryptionError,
|
||||||
GroupEncryptionError, KeysQueryResponse, MegolmEvent,
|
GroupEncryptionError, KeysQueryResponse, MegolmEvent,
|
||||||
RoomEncryptedEvent, SyncResponse)
|
RoomEncryptedEvent, SyncResponse)
|
||||||
@ -99,7 +100,11 @@ class PanClient(AsyncClient):
|
|||||||
self._loop_stop()
|
self._loop_stop()
|
||||||
break
|
break
|
||||||
|
|
||||||
except (ClientProxyConnectionError, ConnectionRefusedError):
|
except (
|
||||||
|
ClientProxyConnectionError,
|
||||||
|
ServerDisconnectedError,
|
||||||
|
ConnectionRefusedError
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
|
Loading…
Reference in New Issue
Block a user