summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-03-01 14:49:41 +0000
committerMark Haines <mark.haines@matrix.org>2016-03-01 14:49:41 +0000
commit60a0f81c7a2da86bf959227a440e3f7a2b727bb5 (patch)
tree68a0f9fe80d57f529d2aa2c9f355e935389fd0d6 /tests/utils.py
parentMerge pull request #611 from matrix-org/erikj/expiring_cache_size (diff)
downloadsynapse-60a0f81c7a2da86bf959227a440e3f7a2b727bb5.tar.xz
Add a /replication API for extracting the updates that happened on
synapse

This is necessary for replicating the data in synapse to be visible to a
separate service because presence and typing notifications aren't stored
in a database so won't be visible to another process.

This API can be used to either get the raw data by requesting the tables
themselves or to just receive notifications for updates by following the
streams meta-stream.

Returns updates for each table requested a JSON array of arrays with a
row for each row in the table.

Each table is prefixed by a header row with the: name of the table,
current stream_id position for the table, number of rows, number of
columns and the names of the columns.
This is followed by the rows that have been added to the server since
the requester last asked.

The API has a timeout and is hooked up to the notifier so that a slave
can long poll for updates.
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/utils.py b/tests/utils.py
index bf7a31ff9e..dfbee5c23a 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -239,9 +239,10 @@ class MockClock(object):
     def looping_call(self, function, interval):
         pass
 
-    def cancel_call_later(self, timer):
+    def cancel_call_later(self, timer, ignore_errs=False):
         if timer[2]:
-            raise Exception("Cannot cancel an expired timer")
+            if not ignore_errs:
+                raise Exception("Cannot cancel an expired timer")
 
         timer[2] = True
         self.timers = [t for t in self.timers if t != timer]