aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-08-22 10:30:35 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-08-22 10:34:07 +0100
commit2668050e535be7527d5dea2e97309027cbc12560 (patch)
treea149ed4bfcd11968aba31d4d13168ff5b25bb09e /roomserver/internal
parent9dc57122d991d54ea6750448ba88c8763a569830 (diff)
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
Diffstat (limited to 'roomserver/internal')
-rw-r--r--roomserver/internal/input/input_events.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go
index 0ece9d14..29af649a 100644
--- a/roomserver/internal/input/input_events.go
+++ b/roomserver/internal/input/input_events.go
@@ -301,7 +301,7 @@ func (r *Inputer) processRoomEvent(
// bother doing this if the event was already rejected as it just ends up
// burning CPU time.
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
historyVisibility, rejectionErr, err = r.processStateBefore(ctx, input, missingPrev)
if err != nil {
@@ -313,7 +313,7 @@ func (r *Inputer) processRoomEvent(
}
// 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 {
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.
- if isRejected || softfail {
- logger.WithError(rejectionErr).WithFields(logrus.Fields{
- "room_id": event.RoomID(),
- "event_id": event.EventID(),
- "soft_fail": softfail,
- "missing_prev": missingPrev,
- }).Warn("Stored rejected event")
+ // We stop here if the event is rejected: We've stored it but won't update
+ // forward extremities or notify downstream components about it.
+ switch {
+ case isRejected:
+ logger.WithError(rejectionErr).Warn("Stored rejected event")
+ if rejectionErr != nil {
+ return types.RejectedError(rejectionErr.Error())
+ }
+ return nil
+
+ case softfail:
+ logger.WithError(rejectionErr).Warn("Stored soft-failed event")
if rejectionErr != nil {
return types.RejectedError(rejectionErr.Error())
}