From 1a0d644b6018ccc73fe79245d2a31e6a29c0c2bb Mon Sep 17 00:00:00 2001 From: luk3yx Date: Fri, 18 Nov 2022 09:35:17 +1300 Subject: [PATCH] Try again in 15s if error returned from /v3/sync --- miniirc_matrix.py | 10 +++++++++- setup.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/miniirc_matrix.py b/miniirc_matrix.py index c99d0d1..1e64b2e 100644 --- a/miniirc_matrix.py +++ b/miniirc_matrix.py @@ -12,7 +12,7 @@ import miniirc, requests, traceback # type: ignore -ver = (0, 0, 7) +ver = (0, 0, 8) __version__ = '.'.join(map(str, ver)) @@ -495,6 +495,14 @@ def _main(self) -> None: if self.debug_file: self.debug(json.dumps(res, indent=4)) if 'error' in res: + # TODO: Use self.debug or something + print(f'[miniirc_matrix] Error returned when trying to ' + f'fetch /sync: {res["error"]!r}') + + if self.persist: + self.debug('Trying again in 15 seconds...') + time.sleep(15) + continue break next_batch = res['next_batch'] if 'rooms' in res: diff --git a/setup.py b/setup.py index d9f71d7..f32a2ac 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='miniirc_matrix', - version='0.0.7', + version='0.0.8', py_modules=['miniirc_matrix'], author='luk3yx', description='A Matrix wrapper for miniirc.',