]> jfr.im git - erebus.git/blobdiff - modules/trivia.py
add watchdog timer. fixes #12
[erebus.git] / modules / trivia.py
index dfa0b7dc5d93566e49c2ccd713839e2eaf365665..cb77be77d990a2388e03415ed6b0b1b1e74f8379 100644 (file)
@@ -110,14 +110,6 @@ class TriviaState(object):
                        self.nextquestiontimer.cancel()
                        self.nextquestiontimer = None
                except: pass
-#TODO remove if the replacement works
-#              if threading is not None and threading._Timer is not None:
-#                      if isinstance(self.steptimer, threading._Timer):
-#                              self.steptimer.cancel()
-#                      if isinstance(self.nextquestiontimer, threading._Timer):
-#                              self.nextquestiontimer.cancel()
-#                              self.nextquestiontimer = None
-#              self.savedb()
 
        def savedb(self): #returns whether or not it was able to save
                if json is not None and json.dump is not None:
@@ -138,7 +130,7 @@ class TriviaState(object):
                                                os.unlink(tmpfn)
                                        except OSError: # temp file is already gone
                                                pass
-                                       raise #TODO: we may be better off just swallowing exceptions?
+                                       raise # we may be better off just swallowing exceptions?
                return False
 
        def getchan(self):
@@ -269,9 +261,9 @@ class TriviaState(object):
                        if 'topicformat' in self.db and self.db['topicformat'] is not None:
                                self.getbot().conn.send("TOPIC %s" % (self.db['chan']))
 
-               if isinstance(self.steptimer, threading._Timer):
+               if isinstance(self.steptimer, MyTimer):
                        self.steptimer.cancel()
-               if isinstance(self.nextquestiontimer, threading._Timer):
+               if isinstance(self.nextquestiontimer, MyTimer):
                        self.nextquestiontimer.cancel()
                        self.nextquestiontimer = None