Don't flake so badly for rejected events

This commit is contained in:
Neil Alexander 2022-02-06 12:02:21 +00:00
parent 908d881a6e
commit 2a2f84052e
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 14 additions and 3 deletions

View file

@ -297,7 +297,7 @@ func (r *Inputer) processRoomEvent(
"soft_fail": softfail,
"missing_prev": missingPrev,
}).Warn("Stored rejected event")
return commitTransaction, rejectionErr
return commitTransaction, types.RejectedError(rejectionErr.Error())
}
switch input.Kind {

View file

@ -12,6 +12,7 @@ import (
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/roomserver/internal/query"
"github.com/matrix-org/dendrite/roomserver/storage/shared"
"github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
"github.com/sirupsen/logrus"
@ -205,7 +206,9 @@ func (t *missingStateReq) processEventWithMissingState(
SendAsServer: api.DoNotSendToOtherServers,
})
if err != nil {
return fmt.Errorf("t.inputer.processRoomEvent: %w", err)
if _, ok := err.(types.RejectedError); !ok {
return fmt.Errorf("t.inputer.processRoomEvent: %w", err)
}
}
// Then send all of the newer backfilled events, of which will all be newer
@ -220,7 +223,9 @@ func (t *missingStateReq) processEventWithMissingState(
SendAsServer: api.DoNotSendToOtherServers,
})
if err != nil {
return fmt.Errorf("t.inputer.processRoomEvent: %w", err)
if _, ok := err.(types.RejectedError); !ok {
return fmt.Errorf("t.inputer.processRoomEvent: %w", err)
}
}
}

View file

@ -209,6 +209,12 @@ type MissingEventError string
func (e MissingEventError) Error() string { return string(e) }
// A RejectedError is returned when an event is stored as rejected. The error
// contains the reason why.
type RejectedError string
func (e RejectedError) Error() string { return string(e) }
// RoomInfo contains metadata about a room
type RoomInfo struct {
RoomNID RoomNID