aboutsummaryrefslogtreecommitdiff
path: root/syncapi/streams/stream_pdu.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-04-20 16:51:37 +0100
committerGitHub <noreply@github.com>2022-04-20 16:51:37 +0100
commit54e7ea41c688a0bcc89150c99045b2dcdf8d0b12 (patch)
tree26f306aec904ec45822bec4fc35d84b3ea684551 /syncapi/streams/stream_pdu.go
parentbb987cd64b118044a4f3351c377516813514ee19 (diff)
Eliminate more SQL no row errors in sync API (#2363)
* Handle `sql.ErrNoRows` in main `/sync` codepaths * Catch more
Diffstat (limited to 'syncapi/streams/stream_pdu.go')
-rw-r--r--syncapi/streams/stream_pdu.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go
index 0f11d55f..df5fb8e0 100644
--- a/syncapi/streams/stream_pdu.go
+++ b/syncapi/streams/stream_pdu.go
@@ -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