Use room version cache in Events()
MODIFY
roomserver/storage/shared/storage.go
roomserver/storage/shared/storage.go
@@ -320,10 +320,15 @@ func (d *Database) Events(
if err != nil {
return nil, err
}
+ if roomID, ok := d.Cache.GetRoomServerRoomID(roomNID); ok {
+ roomVersion, _ = d.Cache.GetRoomVersion(roomID)
+ }
+ if roomVersion == "" {
roomVersion, err = d.RoomsTable.SelectRoomVersionForRoomNID(ctx, roomNID)
if err != nil {
return nil, err
}
+ }
result.Event, err = gomatrixserverlib.NewEventFromTrustedJSON(
eventJSON.EventJSON, false, roomVersion,
)

Use room version cache in Events()