Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Remove state events from /_synapse/admin/v1/rooms/<room_id>/context/<…
Browse files Browse the repository at this point in the history
…event_id>

Real-world tests show that this API is too slow (and timeouts) because serialization
of state events can be extremely slow when there are too many state events, e.g.
in irc rooms.

Signed-off-by: David Teller <davidt@element.io>
  • Loading branch information
Yoric committed Mar 15, 2021
1 parent 55da8df commit 59f3978
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 41 deletions.
1 change: 1 addition & 0 deletions changelog.d/9615.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove state events from /_synapse/admin/v1/rooms/<room_id>/context/<event_id> for performance reasons.
40 changes: 2 additions & 38 deletions docs/admin_api/rooms.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ GET /_synapse/admin/v1/rooms/<room_id>/context/<event_id>

This API mimmicks [GET /_matrix/client/r0/rooms/{roomId}/context/{eventId}](https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-context-eventid). Please refer to the link for all details on parameters and reseponse.

The main difference is that this call does NOT return state events, for performance reasons.

Example response:

```json
Expand Down Expand Up @@ -673,43 +675,5 @@ Example response:
}
],
"start": "t27-54_2_0_2",
"state": [
{
"content": {
"creator": "@example:example.org",
"room_version": "1",
"m.federate": true,
"predecessor": {
"event_id": "$something:example.org",
"room_id": "!oldroom:example.org"
}
},
"type": "m.room.create",
"event_id": "$143273582443PhrSn:example.org",
"room_id": "!636q39766251:example.com",
"sender": "@example:example.org",
"origin_server_ts": 1432735824653,
"unsigned": {
"age": 1234
},
"state_key": ""
},
{
"content": {
"membership": "join",
"avatar_url": "mxc://example.org/SEsfnsuifSDFSSEF",
"displayname": "Alice Margatroid"
},
"type": "m.room.member",
"event_id": "$143273582443PhrSn:example.org",
"room_id": "!636q39766251:example.com",
"sender": "@example:example.org",
"origin_server_ts": 1432735824653,
"unsigned": {
"age": 1234
},
"state_key": "@alice:example.org"
}
]
}
```
3 changes: 0 additions & 3 deletions synapse/rest/admin/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,5 @@ async def on_GET(
results["events_after"] = await self._event_serializer.serialize_events(
results["events_after"], time_now
)
results["state"] = await self._event_serializer.serialize_events(
results["state"], time_now
)

return 200, results

0 comments on commit 59f3978

Please sign in to comment.