summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-02-02 10:40:22 +0100
committerLars-Dominik Braun <lars@6xq.net>2019-02-02 10:40:22 +0100
commit43cb81ff03c574c45da325c9f8149b8b3282f070 (patch)
treea764f8424237bdb4d8ccc2a111cfe10e5adac4bf
parent184189f0a535996edca01a68182ed07d32e26e9c (diff)
downloadcrocoite-43cb81ff03c574c45da325c9f8149b8b3282f070.tar.gz
crocoite-43cb81ff03c574c45da325c9f8149b8b3282f070.tar.bz2
crocoite-43cb81ff03c574c45da325c9f8149b8b3282f070.zip
irc: Retry if reconnect fails
-rw-r--r--crocoite/irc.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/crocoite/irc.py b/crocoite/irc.py
index 5351a85..855d0b0 100644
--- a/crocoite/irc.py
+++ b/crocoite/irc.py
@@ -334,10 +334,14 @@ class ArgparseBot (bottom.Client):
async def onDisconnect (self, **kwargs):
""" Auto-reconnect """
self.logger.info ('disconnect', uuid='4c74b2c8-2403-4921-879d-2279ad85db72')
- if not self._quit.armed:
- await asyncio.sleep (10, loop=self.loop)
- self.logger.info ('reconnect', uuid='c53555cb-e1a4-4b69-b1c9-3320269c19d7')
- await self.connect ()
+ while True:
+ if not self._quit.armed:
+ await asyncio.sleep (10, loop=self.loop)
+ self.logger.info ('reconnect', uuid='c53555cb-e1a4-4b69-b1c9-3320269c19d7')
+ try:
+ await self.connect ()
+ finally:
+ break
def voice (func):
""" Calling user must have voice or ops """