Removing a lot of dead code arising from refactorings in the backend
[theonering] / src / gvoice / state_machine.py
index dfb1412..21495a7 100644 (file)
@@ -172,13 +172,16 @@ class UpdateStateMachine(StateMachine):
                assert self._timeoutId is None
                for strategy in self._strategies.itervalues():
                        strategy.initialize_state()
-               self._timeoutId = gobject.idle_add(self._on_timeout)
+               if self._strategy.timeout != self.INFINITE_PERIOD:
+                       self._timeoutId = gobject.idle_add(self._on_timeout)
                _moduleLogger.info("%s Starting State Machine" % (self._name, ))
 
        def stop(self):
+               _moduleLogger.info("%s Stopping State Machine" % (self._name, ))
                self._stop_update()
 
        def close(self):
+               assert self._timeoutId is None
                self._callback = None
 
        def set_state(self, newState):
@@ -195,6 +198,7 @@ class UpdateStateMachine(StateMachine):
                return self._state
 
        def reset_timers(self):
+               _moduleLogger.info("%s Resetting State Machine" % (self._name, ))
                self._reset_timers()
 
        @property
@@ -235,12 +239,12 @@ class UpdateStateMachine(StateMachine):
 
        @gtk_toolbox.log_exception(_moduleLogger)
        def _on_timeout(self):
-               _moduleLogger.debug("%s Update" % (self._name))
+               _moduleLogger.info("%s Update" % (self._name))
+               self._timeoutId = None
+               self._schedule_update()
                for item in self._updateItems:
                        try:
                                item.update(force=True)
                        except Exception:
                                _moduleLogger.exception("Update failed for %r" % item)
-               self._timeoutId = None
-               self._schedule_update()
                return False # do not continue