Try again in 15s if error returned from /v3/sync

This commit is contained in:
luk3yx
2022-11-18 09:35:17 +13:00
parent c184810355
commit 1a0d644b60
2 changed files with 10 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ import functools, html.parser, itertools, json, math, re, threading, time, uuid
import miniirc, requests, traceback # type: ignore
ver = (0, 0, 7)
ver = (0, 0, 8)
__version__ = '.'.join(map(str, ver))
@@ -495,6 +495,14 @@ class Matrix(miniirc.IRC):
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:

View File

@@ -5,7 +5,7 @@ from setuptools import setup
setup(
name='miniirc_matrix',
version='0.0.7',
version='0.0.8',
py_modules=['miniirc_matrix'],
author='luk3yx',
description='A Matrix wrapper for miniirc.',