diff --git a/internal/caching/impl_ristretto.go b/internal/caching/impl_ristretto.go index b55785136..bce3a590e 100644 --- a/internal/caching/impl_ristretto.go +++ b/internal/caching/impl_ristretto.go @@ -52,8 +52,9 @@ func NewRistrettoCache(maxCost CacheSize, enablePrometheus bool) (*Caches, error Name: "room_ids", }, RoomServerEvents: &RistrettoCachePartition[int64, *gomatrixserverlib.Event]{ - cache: cache, - Name: "room_events", + cache: cache, + Name: "room_events", + Mutable: true, }, RoomInfos: &RistrettoCachePartition[string, types.RoomInfo]{ cache: cache, diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index cbb1f0d64..6df7405b6 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -493,7 +493,9 @@ func (d *Database) events( if err != nil { return nil, err } - d.Cache.StoreRoomServerEvent(result.EventNID, result.Event) + if result.Event != nil { + d.Cache.StoreRoomServerEvent(result.EventNID, result.Event) + } } if !redactionsArePermanent { d.applyRedactions(results)