aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-03-09 09:52:13 +0100
committerGitHub <noreply@github.com>2023-03-09 09:52:13 +0100
commit70322699abcf69531fdb47a282561f19592b8dfd (patch)
treee852c948b1cb81f64fca55c5e1fd5b0c0ec08f05 /internal
parentbaef523cb02f7164ec25a5fcf513a042c5428f01 (diff)
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.
Diffstat (limited to 'internal')
-rw-r--r--internal/caching/cache_roomevents.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/caching/cache_roomevents.go b/internal/caching/cache_roomevents.go
index 9d5d3b91..14b6c3af 100644
--- a/internal/caching/cache_roomevents.go
+++ b/internal/caching/cache_roomevents.go
@@ -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))
+}