summary refs log tree commit diff
path: root/tests/handlers
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-10-10 11:29:01 +0100
committerGitHub <noreply@github.com>2019-10-10 11:29:01 +0100
commita139420a3cfda6a4a4ee4750611b31dd71fc33f3 (patch)
tree9129aff6a5e73673054a1c9125fa977099a2b7db /tests/handlers
parentRewrite the user_filter migration again (#6184) (diff)
downloadsynapse-a139420a3cfda6a4a4ee4750611b31dd71fc33f3.tar.xz
Fix races in room stats (and other) updates. (#6187)
Hopefully this will fix the occasional failures we were seeing in the room directory.

The problem was that events are not necessarily persisted (and `current_state_delta_stream` updated) in the same order as their stream_id. So for instance current_state_delta 9 might be persisted *before* current_state_delta 8. Then, when the room stats saw stream_id 9, it assumed it had done everything up to 9, and never came back to do stream_id 8.

We can solve this easily by only processing up to the stream_id where we know all events have been persisted.
Diffstat (limited to 'tests/handlers')
-rw-r--r--tests/handlers/test_typing.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/handlers/test_typing.py b/tests/handlers/test_typing.py
index 1f2ef5d01f..67f1013051 100644
--- a/tests/handlers/test_typing.py
+++ b/tests/handlers/test_typing.py
@@ -139,7 +139,7 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase):
             defer.succeed(1)
         )
 
-        self.datastore.get_current_state_deltas.return_value = None
+        self.datastore.get_current_state_deltas.return_value = (0, None)
 
         self.datastore.get_to_device_stream_token = lambda: 0
         self.datastore.get_new_device_msgs_for_remote = lambda *args, **kargs: ([], 0)