forked from kate/uniborg
Use connection_retries
This commit is contained in:
parent
1d3ac0a215
commit
65277214fe
|
@ -8,6 +8,6 @@ from uniborg import Uniborg
|
|||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
borg = Uniborg("stdborg", plugin_path="stdplugins")
|
||||
borg = Uniborg("stdborg", plugin_path="stdplugins", connection_retries=None)
|
||||
|
||||
borg.run()
|
||||
borg.run_until_disconnected()
|
||||
|
|
|
@ -52,21 +52,6 @@ class Uniborg(TelegramClient):
|
|||
self.me = await self.get_me()
|
||||
self.uid = telethon.utils.get_peer_id(self.me)
|
||||
|
||||
async def _reconnect_nofail(self):
|
||||
while True:
|
||||
try:
|
||||
await self.connect()
|
||||
return
|
||||
except ConnectionError:
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
try:
|
||||
self.run_until_disconnected()
|
||||
except ConnectionError:
|
||||
self.loop.run_until_complete(self._reconnect_nofail())
|
||||
|
||||
def load_plugin(self, shortname):
|
||||
self.load_plugin_from_file(f"{self._plugin_path}/{shortname}.py")
|
||||
|
||||
|
|
Loading…
Reference in New Issue