1. Marcin Kasperski
  2. mekk.fics

Commits

Marcin Kasperski  committed 6320c1f

Bugfix for

File "/home/marcink/PY_ENV/watchbot2/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 138, in maybeDeferred
result = f(*args, **kw)
File "/home/marcink/watchbot_run/mekk.fics/src/mekk/fics/support/keep_alive.py";, line 163, in _wakeup
self._on_critical_failure()
File "/home/marcink/watchbot_run/mekk.fics/src/mekk/fics/support/keep_alive.py";, line 75, in <lambda>
self._on_critical_failure = lambda: reactor.stop()
File "/home/marcink/PY_ENV/watchbot2/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 582, in stop
"Can't stop reactor that isn't running.")
twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.

(now we check whether reactor is running before stopping it)

  • Participants
  • Parent commits b2193d5
  • Branches default

Comments (0)

Files changed (1)

File src/mekk/fics/support/keep_alive.py

View file
  • Ignore whitespace
         :param start_immediately: should we make first call straight away (True),
             or after frequency passes (False, default)
         """
+        def default_on_critical_failure():
+            if reactor.running:
+                reactor.stop()
+
         self._command = command
         self._on_failure = on_failure
         self._on_success = on_success
         if on_critical_failure:
             self._on_critical_failure = on_critical_failure
         else:
-            self._on_critical_failure = lambda: reactor.stop()
+            self._on_critical_failure = default_on_critical_failure
         self._label = label
         self._frequency = frequency
         if (timeout > 0) and (timeout < 0.8 * frequency):