From 4b6139b62eb91ba059b47415b0275964b37d9b43 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 6 Feb 2022 16:12:58 +0000 Subject: [PATCH] Don't count rejected events as missing --- roomserver/storage/postgres/events_table.go | 2 +- roomserver/storage/sqlite3/events_table.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roomserver/storage/postgres/events_table.go b/roomserver/storage/postgres/events_table.go index 6c3847752..4372e7767 100644 --- a/roomserver/storage/postgres/events_table.go +++ b/roomserver/storage/postgres/events_table.go @@ -316,7 +316,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID( } // Genuine create events are the only case where it's OK to have no previous state. isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1 - if result.BeforeStateSnapshotNID == 0 && !isCreate { + if result.BeforeStateSnapshotNID == 0 && !result.IsRejected && !isCreate { return nil, types.MissingEventError( fmt.Sprintf("storage: missing state for event NID %d", result.EventNID), ) diff --git a/roomserver/storage/sqlite3/events_table.go b/roomserver/storage/sqlite3/events_table.go index e1e6a597c..ed0f283c9 100644 --- a/roomserver/storage/sqlite3/events_table.go +++ b/roomserver/storage/sqlite3/events_table.go @@ -327,7 +327,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID( } // Genuine create events are the only case where it's OK to have no previous state. isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1 - if result.BeforeStateSnapshotNID == 0 && !isCreate { + if result.BeforeStateSnapshotNID == 0 && !result.IsRejected && !isCreate { return nil, types.MissingEventError( fmt.Sprintf("storage: missing state for event NID %d", result.EventNID), )