Some guards

This commit is contained in:
Neil Alexander 2022-06-14 16:52:27 +01:00
parent c4c2c9d0ff
commit 3f9617e373
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 6 additions and 3 deletions

View file

@ -52,8 +52,9 @@ func NewRistrettoCache(maxCost CacheSize, enablePrometheus bool) (*Caches, error
Name: "room_ids", Name: "room_ids",
}, },
RoomServerEvents: &RistrettoCachePartition[int64, *gomatrixserverlib.Event]{ RoomServerEvents: &RistrettoCachePartition[int64, *gomatrixserverlib.Event]{
cache: cache, cache: cache,
Name: "room_events", Name: "room_events",
Mutable: true,
}, },
RoomInfos: &RistrettoCachePartition[string, types.RoomInfo]{ RoomInfos: &RistrettoCachePartition[string, types.RoomInfo]{
cache: cache, cache: cache,

View file

@ -493,7 +493,9 @@ func (d *Database) events(
if err != nil { if err != nil {
return nil, err return nil, err
} }
d.Cache.StoreRoomServerEvent(result.EventNID, result.Event) if result.Event != nil {
d.Cache.StoreRoomServerEvent(result.EventNID, result.Event)
}
} }
if !redactionsArePermanent { if !redactionsArePermanent {
d.applyRedactions(results) d.applyRedactions(results)