summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-03-04 18:27:32 +0000
committerRichard van der Hoff <richard@matrix.org>2019-03-04 18:27:32 +0000
commitdaa10e3e66dadef3b860c31baaeded1da92430be (patch)
tree167689b9ae5e6ae448e269b51773c0a03cf15538 /synapse/notifier.py
parentInclude a default configuration file in the 'docs' directory. (#4791) (diff)
downloadsynapse-daa10e3e66dadef3b860c31baaeded1da92430be.tar.xz
Remove unused `wait_for_replication` method
I guess this was used once? It's not now, anyway.
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r--synapse/notifier.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index de02b1017e..2505202e98 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -178,8 +178,6 @@ class Notifier(object):
             self.remove_expired_streams, self.UNUSED_STREAM_EXPIRY_MS
         )
 
-        self.replication_deferred = ObservableDeferred(defer.Deferred())
-
         # This is not a very cheap test to perform, but it's only executed
         # when rendering the metrics page, which is likely once per minute at
         # most when scraping it.
@@ -518,10 +516,6 @@ class Notifier(object):
     def notify_replication(self):
         """Notify the any replication listeners that there's a new event"""
         with PreserveLoggingContext():
-            deferred = self.replication_deferred
-            self.replication_deferred = ObservableDeferred(defer.Deferred())
-            deferred.callback(None)
-
             # the callbacks may well outlast the current request, so we run
             # them in the sentinel logcontext.
             #
@@ -530,47 +524,3 @@ class Notifier(object):
             # accordingly, but that requires more changes)
             for cb in self.replication_callbacks:
                 cb()
-
-    @defer.inlineCallbacks
-    def wait_for_replication(self, callback, timeout):
-        """Wait for an event to happen.
-
-        Args:
-            callback: Gets called whenever an event happens. If this returns a
-                truthy value then ``wait_for_replication`` returns, otherwise
-                it waits for another event.
-            timeout: How many milliseconds to wait for callback return a truthy
-                value.
-
-        Returns:
-            A deferred that resolves with the value returned by the callback.
-        """
-        listener = _NotificationListener(None)
-
-        end_time = self.clock.time_msec() + timeout
-
-        while True:
-            listener.deferred = self.replication_deferred.observe()
-            result = yield callback()
-            if result:
-                break
-
-            now = self.clock.time_msec()
-            if end_time <= now:
-                break
-
-            listener.deferred = timeout_deferred(
-                listener.deferred,
-                timeout=(end_time - now) / 1000.,
-                reactor=self.hs.get_reactor(),
-            )
-
-            try:
-                with PreserveLoggingContext():
-                    yield listener.deferred
-            except defer.TimeoutError:
-                break
-            except defer.CancelledError:
-                break
-
-        defer.returnValue(result)