aboutsummaryrefslogtreecommitdiff
path: root/roomserver/storage/shared/storage.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-07-13 10:13:34 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-07-13 10:13:34 +0100
commita1f9b02edfd56809eaedd04fd233b1828085e190 (patch)
treedc48e75fcc7244230c5004c1df69d5be0a571329 /roomserver/storage/shared/storage.go
parent9cd8e9d4b97c6cff66665f57065a5bb8b7144045 (diff)
Pointerise `types.RoomInfo` in the cache so we can update it in-place in the latest events updater
Diffstat (limited to 'roomserver/storage/shared/storage.go')
-rw-r--r--roomserver/storage/shared/storage.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go
index 692af1f6..d8d5f67c 100644
--- a/roomserver/storage/shared/storage.go
+++ b/roomserver/storage/shared/storage.go
@@ -139,13 +139,13 @@ func (d *Database) RoomInfo(ctx context.Context, roomID string) (*types.RoomInfo
}
func (d *Database) roomInfo(ctx context.Context, txn *sql.Tx, roomID string) (*types.RoomInfo, error) {
- if roomInfo, ok := d.Cache.GetRoomInfo(roomID); ok {
- return &roomInfo, nil
+ if roomInfo, ok := d.Cache.GetRoomInfo(roomID); ok && roomInfo != nil {
+ return roomInfo, nil
}
roomInfo, err := d.RoomsTable.SelectRoomInfo(ctx, txn, roomID)
if err == nil && roomInfo != nil {
d.Cache.StoreRoomServerRoomID(roomInfo.RoomNID, roomID)
- d.Cache.StoreRoomInfo(roomID, *roomInfo)
+ d.Cache.StoreRoomInfo(roomID, roomInfo)
}
return roomInfo, err
}