Don't count rejected events as missing

This commit is contained in:
Neil Alexander 2022-02-06 16:12:58 +00:00
parent 78a9a6de2a
commit 4b6139b62e
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 2 additions and 2 deletions

View file

@ -316,7 +316,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
} }
// Genuine create events are the only case where it's OK to have no previous state. // Genuine create events are the only case where it's OK to have no previous state.
isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1 isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1
if result.BeforeStateSnapshotNID == 0 && !isCreate { if result.BeforeStateSnapshotNID == 0 && !result.IsRejected && !isCreate {
return nil, types.MissingEventError( return nil, types.MissingEventError(
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID), fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
) )

View file

@ -327,7 +327,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
} }
// Genuine create events are the only case where it's OK to have no previous state. // Genuine create events are the only case where it's OK to have no previous state.
isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1 isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1
if result.BeforeStateSnapshotNID == 0 && !isCreate { if result.BeforeStateSnapshotNID == 0 && !result.IsRejected && !isCreate {
return nil, types.MissingEventError( return nil, types.MissingEventError(
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID), fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
) )