diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-10-05 14:43:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 14:43:14 +0100 |
commit | f31f8e63198cfe46af48d788dbb294aba9155e5a (patch) | |
tree | 603352c2adac33e3348be771f54f4c8d130eb582 /synapse/rest | |
parent | Update manhole documentation for async/await. (#8462) (diff) | |
download | synapse-f31f8e63198cfe46af48d788dbb294aba9155e5a.tar.xz |
Remove stream ordering from Metadata dict (#8452)
There's no need for it to be in the dict as well as the events table. Instead, we store it in a separate attribute in the EventInternalMetadata object, and populate that on load. This means that we can rely on it being correctly populated for any event which has been persited to the database.
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/admin/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/rest/admin/__init__.py b/synapse/rest/admin/__init__.py index 57cac22252..789431ef25 100644 --- a/synapse/rest/admin/__init__.py +++ b/synapse/rest/admin/__init__.py @@ -57,6 +57,7 @@ from synapse.rest.admin.users import ( UsersRestServletV2, WhoisRestServlet, ) +from synapse.types import RoomStreamToken from synapse.util.versionstring import get_version_string logger = logging.getLogger(__name__) @@ -109,7 +110,9 @@ class PurgeHistoryRestServlet(RestServlet): if event.room_id != room_id: raise SynapseError(400, "Event is for wrong room.") - room_token = await self.store.get_topological_token_for_event(event_id) + room_token = RoomStreamToken( + event.depth, event.internal_metadata.stream_ordering + ) token = await room_token.to_string(self.store) logger.info("[purge] purging up to token %s (event_id %s)", token, event_id) |