summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-01-15 18:56:18 +0000
committerBrendan Abolivier <babolivier@matrix.org>2020-01-15 18:56:18 +0000
commit855af069a494f826ef941d722c811287b3fc4a8c (patch)
tree88a4f9218c5867dcb0a2da82066b345430c5b88f /synapse/handlers
parentProcess EDUs in parallel with PDUs. (#6697) (diff)
downloadsynapse-855af069a494f826ef941d722c811287b3fc4a8c.tar.xz
Fix instantiation of message retention purge jobs
When figuring out which topological token to start a purge job at, we
need to do the following:

1. Figure out a timestamp before which events will be purged
2. Select the first stream ordering after that timestamp
3. Select info about the first event after that stream ordering
4. Build a topological token from that info

In some situations (e.g. quiet rooms with a short max_lifetime), there
might not be an event after the stream ordering at step 3, therefore we
abort the purge with the error `No event found`. To mitigate that, this
patch fetches the first event _before_ the stream ordering, instead of
after.
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/pagination.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py
index 00a6afc963..3ee6a091c5 100644
--- a/synapse/handlers/pagination.py
+++ b/synapse/handlers/pagination.py
@@ -156,7 +156,7 @@ class PaginationHandler(object):
 
             stream_ordering = yield self.store.find_first_stream_ordering_after_ts(ts)
 
-            r = yield self.store.get_room_event_after_stream_ordering(
+            r = yield self.store.get_room_event_before_stream_ordering(
                 room_id, stream_ordering,
             )
             if not r: