mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 05:42:46 +00:00
Eliminate more SQL no row errors in sync API (#2363)
* Handle `sql.ErrNoRows` in main `/sync` codepaths * Catch more
This commit is contained in:
parent
bb987cd64b
commit
54e7ea41c6
2 changed files with 37 additions and 4 deletions
|
@ -341,12 +341,16 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync(
|
|||
wantFullState bool,
|
||||
device *userapi.Device,
|
||||
) (jr *types.JoinResponse, err error) {
|
||||
jr = types.NewJoinResponse()
|
||||
// TODO: When filters are added, we may need to call this multiple times to get enough events.
|
||||
// See: https://github.com/matrix-org/synapse/blob/v0.19.3/synapse/handlers/sync.py#L316
|
||||
recentStreamEvents, limited, err := p.DB.RecentEvents(
|
||||
ctx, roomID, r, eventFilter, true, true,
|
||||
)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return jr, nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -430,12 +434,11 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync(
|
|||
false, limited, stateFilter.IncludeRedundantMembers,
|
||||
device, recentEvents, stateEvents,
|
||||
)
|
||||
if err != nil {
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
jr = types.NewJoinResponse()
|
||||
jr.Summary.JoinedMemberCount = &joinedCount
|
||||
jr.Summary.InvitedMemberCount = &invitedCount
|
||||
jr.Timeline.PrevBatch = prevBatch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue