Anonymous avatar Anonymous 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&quot;, 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)

Comments (0)

Files changed (1)

src/mekk/fics/support/keep_alive.py

         :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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.