Check for errors during sync

This commit is contained in:
Andrew Morgan 2019-09-29 17:30:57 +01:00
parent 3df8d481c9
commit 5c7760e2c0

View file

@ -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: