Use connection_retries

This commit is contained in:
Dan Elkouby 2018-06-21 18:57:06 +03:00
parent 1d3ac0a215
commit 65277214fe
2 changed files with 2 additions and 17 deletions

View File

@ -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()

View File

@ -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")