mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Add RoomInfo cache, remove RoomServerRoomNIDsCache (#1646)
* Add RoomInfo cache, remove RoomServerRoomNID cache, ensure caches are thread-safe * Don't panic if the roomInfo isn't known yet * LRU package is already threadsafe * Use RoomInfo cache to find room version if possible in Events() * Adding comments about RoomInfoCache safety
This commit is contained in:
parent
9057143033
commit
b891c00b09
6 changed files with 88 additions and 41 deletions
|
@ -105,6 +105,13 @@ func (u *LatestEventsUpdater) SetLatestEvents(
|
|||
if err := u.d.RoomsTable.UpdateLatestEventNIDs(u.ctx, txn, roomNID, eventNIDs, lastEventNIDSent, currentStateSnapshotNID); err != nil {
|
||||
return fmt.Errorf("u.d.RoomsTable.updateLatestEventNIDs: %w", err)
|
||||
}
|
||||
if roomID, ok := u.d.Cache.GetRoomServerRoomID(roomNID); ok {
|
||||
if roomInfo, ok := u.d.Cache.GetRoomInfo(roomID); ok {
|
||||
roomInfo.StateSnapshotNID = currentStateSnapshotNID
|
||||
roomInfo.IsStub = false
|
||||
u.d.Cache.StoreRoomInfo(roomID, roomInfo)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue