mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
Tweak soft-failure handling in roomserver
commit 1929b688e31987c46e0c8a546f0f9cb0a46bf9a3 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Mon Aug 22 10:09:44 2022 +0100 Still process state-before for soft-failed events commit e83c0b701d40d78b92072c4643f6bc6f71b72800 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Mon Aug 22 10:06:50 2022 +0100 Improve logging commit 29e26124bc27cb83d449de2a4214b253c594aa93 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Mon Aug 22 09:58:13 2022 +0100 Don't store soft-failed events as rejected
This commit is contained in:
parent
9dc57122d9
commit
2668050e53
@ -301,7 +301,7 @@ func (r *Inputer) processRoomEvent(
|
|||||||
// bother doing this if the event was already rejected as it just ends up
|
// bother doing this if the event was already rejected as it just ends up
|
||||||
// burning CPU time.
|
// burning CPU time.
|
||||||
historyVisibility := gomatrixserverlib.HistoryVisibilityShared // Default to shared.
|
historyVisibility := gomatrixserverlib.HistoryVisibilityShared // Default to shared.
|
||||||
if input.Kind != api.KindOutlier && rejectionErr == nil && !isRejected && !softfail {
|
if input.Kind != api.KindOutlier && rejectionErr == nil && !isRejected {
|
||||||
var err error
|
var err error
|
||||||
historyVisibility, rejectionErr, err = r.processStateBefore(ctx, input, missingPrev)
|
historyVisibility, rejectionErr, err = r.processStateBefore(ctx, input, missingPrev)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -313,7 +313,7 @@ func (r *Inputer) processRoomEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store the event.
|
// Store the event.
|
||||||
_, _, stateAtEvent, redactionEvent, redactedEventID, err := r.DB.StoreEvent(ctx, event, authEventNIDs, isRejected || softfail)
|
_, _, stateAtEvent, redactionEvent, redactedEventID, err := r.DB.StoreEvent(ctx, event, authEventNIDs, isRejected)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("updater.StoreEvent: %w", err)
|
return fmt.Errorf("updater.StoreEvent: %w", err)
|
||||||
}
|
}
|
||||||
@ -353,14 +353,18 @@ func (r *Inputer) processRoomEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We stop here if the event is rejected: We've stored it but won't update forward extremities or notify anyone about it.
|
// We stop here if the event is rejected: We've stored it but won't update
|
||||||
if isRejected || softfail {
|
// forward extremities or notify downstream components about it.
|
||||||
logger.WithError(rejectionErr).WithFields(logrus.Fields{
|
switch {
|
||||||
"room_id": event.RoomID(),
|
case isRejected:
|
||||||
"event_id": event.EventID(),
|
logger.WithError(rejectionErr).Warn("Stored rejected event")
|
||||||
"soft_fail": softfail,
|
if rejectionErr != nil {
|
||||||
"missing_prev": missingPrev,
|
return types.RejectedError(rejectionErr.Error())
|
||||||
}).Warn("Stored rejected event")
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
|
case softfail:
|
||||||
|
logger.WithError(rejectionErr).Warn("Stored soft-failed event")
|
||||||
if rejectionErr != nil {
|
if rejectionErr != nil {
|
||||||
return types.RejectedError(rejectionErr.Error())
|
return types.RejectedError(rejectionErr.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user