summary refs log tree commit diff
path: root/synapse/util/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-06-18 15:49:05 +0100
committerErik Johnston <erik@matrix.org>2015-06-18 15:49:24 +0100
commit22049ea700173017cf2f8e88fb8848e06b82f9b3 (patch)
tree5a6375689c4009777690da704bc2baec86e5a014 /synapse/util/__init__.py
parentFix notifier leak (diff)
downloadsynapse-22049ea700173017cf2f8e88fb8848e06b82f9b3.tar.xz
Refactor the notifier.wait_for_events code to be clearer. Add _NotifierUserStream.new_listener that accpets a token to avoid races.
Diffstat (limited to 'synapse/util/__init__.py')
-rw-r--r--synapse/util/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py
index 260714ccc2..07ff25cef3 100644
--- a/synapse/util/__init__.py
+++ b/synapse/util/__init__.py
@@ -91,8 +91,12 @@ class Clock(object):
         with PreserveLoggingContext():
             return reactor.callLater(delay, wrapped_callback, *args, **kwargs)
 
-    def cancel_call_later(self, timer):
-        timer.cancel()
+    def cancel_call_later(self, timer, ignore_errs=False):
+        try:
+            timer.cancel()
+        except:
+            if not ignore_errs:
+                raise
 
     def time_bound_deferred(self, given_deferred, time_out):
         if given_deferred.called: