summary refs log tree commit diff
path: root/synapse/rest/client/v1/admin.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-06-07 00:15:49 +0100
committerRichard van der Hoff <richard@matrix.org>2018-06-07 00:15:49 +0100
commit0546715c18c9ca4882146e91565a94666606674b (patch)
tree3b54194448da374b8b06dd2f3a8fedf187dedfbf /synapse/rest/client/v1/admin.py
parentMerge pull request #3347 from krombel/py3_extend_tox_2 (diff)
downloadsynapse-0546715c18c9ca4882146e91565a94666606674b.tar.xz
Fix event-purge-by-ts admin API
This got completely broken in 0.30.

Fixes #3300.
Diffstat (limited to 'synapse/rest/client/v1/admin.py')
-rw-r--r--synapse/rest/client/v1/admin.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/rest/client/v1/admin.py b/synapse/rest/client/v1/admin.py
index 6835a7bba2..8458195256 100644
--- a/synapse/rest/client/v1/admin.py
+++ b/synapse/rest/client/v1/admin.py
@@ -169,16 +169,12 @@ class PurgeHistoryRestServlet(ClientV1RestServlet):
                 yield self.store.find_first_stream_ordering_after_ts(ts)
             )
 
-            room_event_after_stream_ordering = (
+            r = (
                 yield self.store.get_room_event_after_stream_ordering(
                     room_id, stream_ordering,
                 )
             )
-            if room_event_after_stream_ordering:
-                token = yield self.store.get_topological_token_for_event(
-                    room_event_after_stream_ordering,
-                )
-            else:
+            if not r:
                 logger.warn(
                     "[purge] purging events not possible: No event found "
                     "(received_ts %i => stream_ordering %i)",
@@ -189,6 +185,8 @@ class PurgeHistoryRestServlet(ClientV1RestServlet):
                     "there is no event to be purged",
                     errcode=Codes.NOT_FOUND,
                 )
+            (stream, topo, _event_id) = r
+            token = "t%d-%d" % (topo, stream)
             logger.info(
                 "[purge] purging up to token %d (received_ts %i => "
                 "stream_ordering %i)",