summaryrefslogtreecommitdiffstats
path: root/Reaktor/IRC
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2014-03-25 09:46:43 +0100
committermakefu <github@syntax-fehler.de>2014-03-25 09:46:43 +0100
commit2d1b9414edc8aa57adbe9ac547292921936d874a (patch)
tree90ab1b1a97d9055ebede6118afec6abcec6149a8 /Reaktor/IRC
parent1610072ff0aac8de91c7bf3919bfd75b5fba0e6c (diff)
add eloop to IRc/reaktor
Diffstat (limited to 'Reaktor/IRC')
-rwxr-xr-xReaktor/IRC/reaktor.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Reaktor/IRC/reaktor.py b/Reaktor/IRC/reaktor.py
index 4fb8f75c..3fcedf60 100755
--- a/Reaktor/IRC/reaktor.py
+++ b/Reaktor/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)
+