aboutsummaryrefslogtreecommitdiff
path: root/roomserver/storage
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-09-21 16:49:37 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2020-09-21 16:49:37 +0100
commit45de9dc1c04e544a663e198a1107bcddc5712726 (patch)
treeec81ffbc78939182639c74381d58eab8740277a1 /roomserver/storage
parenta06c18bb562749db1a175a6295e995ec877f1c92 (diff)
Use room version cache in Events()
Diffstat (limited to 'roomserver/storage')
-rw-r--r--roomserver/storage/shared/storage.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go
index e710b99b..f8e733ab 100644
--- a/roomserver/storage/shared/storage.go
+++ b/roomserver/storage/shared/storage.go
@@ -320,9 +320,14 @@ func (d *Database) Events(
if err != nil {
return nil, err
}
- roomVersion, err = d.RoomsTable.SelectRoomVersionForRoomNID(ctx, roomNID)
- 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,