diff options
| author | makefu <github@syntax-fehler.de> | 2014-03-25 09:46:43 +0100 | 
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2014-03-25 09:46:43 +0100 | 
| commit | 73660933bbc63dddd8056d956f86ca23c23c1632 (patch) | |
| tree | fc1b2dabdaf24688880cd8e551b209ee524fe027 /IRC | |
| parent | 2b2600a92fd5bbd1a1f05e08fce55cb1785417a1 (diff) | |
add eloop to IRc/reaktor
Diffstat (limited to 'IRC')
| -rwxr-xr-x | IRC/reaktor.py | 14 | 
1 files changed, 12 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) + | 
