aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xIRC/reaktor.py14
-rw-r--r--config.py1
2 files changed, 13 insertions, 2 deletions
diff --git a/IRC/reaktor.py b/IRC/reaktor.py
index 4fb8f75..3fcedf6 100755
--- a/IRC/reaktor.py
+++ b/IRC/reaktor.py
@@ -18,6 +18,7 @@ hdlr.setFormatter(formatter)
log.addHandler(hdlr)
logging.basicConfig(level = logging.DEBUG if getconf('debug') else logging.INFO)
+restart_timeout = getconf('irc_restart_timeout') or 5
class Reaktor(asybot):
def __init__(self):
@@ -68,5 +69,14 @@ class Reaktor(asybot):
self.ME(target, 'mimimi')
if __name__ == "__main__":
- Reaktor()
- loop()
+ while True:
+ try:
+ Reaktor()
+ loop()
+ except Exception as e:
+ from time import sleep
+ log.error("Something went wrong when running Reaktor, \
+ waiting for %d seconds" % restart_timeout)
+ log.debug("Exception: %s" % str(e))
+ sleep(restart_timeout)
+
diff --git a/config.py b/config.py
index 2dd6ac2..928c49d 100644
--- a/config.py
+++ b/config.py
@@ -10,6 +10,7 @@ irc_kill_timeout = 360
irc_nickname = name
irc_server = 'irc.freenode.org'
irc_port = 6667
+#irc_restart_timeout = 5
irc_channels = [
'#krebs'
]