mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Use room version cache in Events()
This commit is contained in:
parent
a06c18bb56
commit
45de9dc1c0
1 changed files with 8 additions and 3 deletions
|
@ -320,10 +320,15 @@ func (d *Database) Events(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
roomVersion, err = d.RoomsTable.SelectRoomVersionForRoomNID(ctx, roomNID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
result.Event, err = gomatrixserverlib.NewEventFromTrustedJSON(
|
result.Event, err = gomatrixserverlib.NewEventFromTrustedJSON(
|
||||||
eventJSON.EventJSON, false, roomVersion,
|
eventJSON.EventJSON, false, roomVersion,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue