Unset RoomServerEvent, since we can't be sure that Set actually updates

the cached entry
This commit is contained in:
Till Faelligen 2023-03-08 10:41:47 +01:00
parent baef523cb0
commit d95b0cd1ae
No known key found for this signature in database
GPG key ID: ACCDC9606D472758
2 changed files with 6 additions and 1 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))
}

View file

@ -1020,7 +1020,7 @@ func (d *EventDatabase) MaybeRedactEvent(
return fmt.Errorf("d.RedactionsTable.MarkRedactionValidated: %w", err)
}
d.Cache.StoreRoomServerEvent(redactedEvent.EventNID, redactedEvent.Event)
d.Cache.InvalidateRoomServerEvent(redactedEvent.EventNID)
return nil
})