aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage/shared/syncserver.go
diff options
context:
space:
mode:
Diffstat (limited to 'syncapi/storage/shared/syncserver.go')
-rw-r--r--syncapi/storage/shared/syncserver.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go
index 6c35a765..9df04943 100644
--- a/syncapi/storage/shared/syncserver.go
+++ b/syncapi/storage/shared/syncserver.go
@@ -31,6 +31,7 @@ import (
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
+ "github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
)
@@ -514,25 +515,28 @@ func (d *Database) addPDUDeltaToResponse(
deltas, joinedRoomIDs, err = d.getStateDeltas(
ctx, &device, txn, r, device.UserID, &stateFilter,
)
+ if err != nil {
+ return nil, fmt.Errorf("d.getStateDeltas: %w", err)
+ }
} else {
deltas, joinedRoomIDs, err = d.getStateDeltasForFullStateSync(
ctx, &device, txn, r, device.UserID, &stateFilter,
)
- }
- if err != nil {
- return nil, err
+ if err != nil {
+ return nil, fmt.Errorf("d.getStateDeltasForFullStateSync: %w", err)
+ }
}
for _, delta := range deltas {
err = d.addRoomDeltaToResponse(ctx, &device, txn, r, delta, numRecentEventsPerRoom, res)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("d.addRoomDeltaToResponse: %w", err)
}
}
// TODO: This should be done in getStateDeltas
if err = d.addInvitesToResponse(ctx, txn, device.UserID, r, res); err != nil {
- return nil, err
+ return nil, fmt.Errorf("d.addInvitesToResponse: %w", err)
}
succeeded = true
@@ -1126,7 +1130,13 @@ func (d *Database) fetchMissingStateEvents(
return nil, err
}
if len(stateEvents) != len(missing) {
- return nil, fmt.Errorf("failed to map all event IDs to events: (got %d, wanted %d)", len(stateEvents), len(missing))
+ logrus.WithContext(ctx).Warnf("Failed to map all event IDs to events (got %d, wanted %d)", len(stateEvents), len(missing))
+
+ // TODO: Why is this happening? It's probably the roomserver. Uncomment
+ // this error again when we work out what it is and fix it, otherwise we
+ // just end up returning lots of 500s to the client and that breaks
+ // pretty much everything, rather than just sending what we have.
+ //return nil, fmt.Errorf("failed to map all event IDs to events: (got %d, wanted %d)", len(stateEvents), len(missing))
}
events = append(events, stateEvents...)
return events, nil