Unset RoomServerEvent, since we can't be sure that Set actually updates the cached entry (#3002)

This should deflake UTs and be more correct in terms of getting
`Events`.
`Events` tries to fetch the event from the cache first and may get an
unredacted event from it, while it should already be redacted.
This commit is contained in:
Till 2023-03-09 09:52:13 +01:00 committed by GitHub
parent baef523cb0
commit 70322699ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import (
type RoomServerEventsCache interface {
GetRoomServerEvent(eventNID types.EventNID) (*gomatrixserverlib.Event, bool)
StoreRoomServerEvent(eventNID types.EventNID, event *gomatrixserverlib.Event)
InvalidateRoomServerEvent(eventNID types.EventNID)
}
func (c Caches) GetRoomServerEvent(eventNID types.EventNID) (*gomatrixserverlib.Event, bool) {
@ -19,3 +20,7 @@ func (c Caches) GetRoomServerEvent(eventNID types.EventNID) (*gomatrixserverlib.
func (c Caches) StoreRoomServerEvent(eventNID types.EventNID, event *gomatrixserverlib.Event) {
c.RoomServerEvents.Set(int64(eventNID), event)
}
func (c Caches) InvalidateRoomServerEvent(eventNID types.EventNID) {
c.RoomServerEvents.Unset(int64(eventNID))
}