Check for errors during sync
This commit is contained in:
parent
3df8d481c9
commit
5c7760e2c0
1 changed files with 6 additions and 0 deletions
6
main.py
6
main.py
|
@ -7,6 +7,7 @@ from nio import (
|
||||||
AsyncClientConfig,
|
AsyncClientConfig,
|
||||||
RoomMessageText,
|
RoomMessageText,
|
||||||
InviteEvent,
|
InviteEvent,
|
||||||
|
SyncError,
|
||||||
)
|
)
|
||||||
from callbacks import Callbacks
|
from callbacks import Callbacks
|
||||||
from config import Config
|
from config import Config
|
||||||
|
@ -52,6 +53,11 @@ async def main():
|
||||||
# Sync with the server
|
# Sync with the server
|
||||||
sync_response = await client.sync(timeout=30000, full_state=True, since=token)
|
sync_response = await client.sync(timeout=30000, full_state=True, since=token)
|
||||||
|
|
||||||
|
# Check if the sync had an error
|
||||||
|
if type(sync_response) == SyncError:
|
||||||
|
logger.warning("Error in client sync: %s", sync_response.message)
|
||||||
|
continue
|
||||||
|
|
||||||
# Save the latest sync token
|
# Save the latest sync token
|
||||||
token = sync_response.next_batch
|
token = sync_response.next_batch
|
||||||
if token:
|
if token:
|
||||||
|
|
Loading…
Reference in a new issue