aboutsummaryrefslogtreecommitdiff
path: root/syncapi/sync/requestpool.go
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-09-22 17:49:35 +0200
committerGitHub <noreply@github.com>2022-09-22 17:49:35 +0200
commitc53f284fdbe635e1f87dc1da13fcf14b4b16e6a3 (patch)
treedf28163ded700e40229b5dcbfa213487d6f57031 /syncapi/sync/requestpool.go
parentf40e2803276001cafd4d382c64a661d6ea740870 (diff)
Get the `DeviceListPosition` before anything else in complete syncs (#2733)
This should hopefully unflake `Can query remote device keys using POST` in Complement.
Diffstat (limited to 'syncapi/sync/requestpool.go')
-rw-r--r--syncapi/sync/requestpool.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/syncapi/sync/requestpool.go b/syncapi/sync/requestpool.go
index c2c9616e..b2ea105f 100644
--- a/syncapi/sync/requestpool.go
+++ b/syncapi/sync/requestpool.go
@@ -308,6 +308,12 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
if syncReq.Since.IsEmpty() {
// Complete sync
syncReq.Response.NextBatch = types.StreamingToken{
+ // Get the current DeviceListPosition first, as the currentPosition
+ // might advance while processing other streams, resulting in flakey
+ // tests.
+ DeviceListPosition: rp.streams.DeviceListStreamProvider.CompleteSync(
+ syncReq.Context, syncReq,
+ ),
PDUPosition: rp.streams.PDUStreamProvider.CompleteSync(
syncReq.Context, syncReq,
),
@@ -329,9 +335,6 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
NotificationDataPosition: rp.streams.NotificationDataStreamProvider.CompleteSync(
syncReq.Context, syncReq,
),
- DeviceListPosition: rp.streams.DeviceListStreamProvider.CompleteSync(
- syncReq.Context, syncReq,
- ),
PresencePosition: rp.streams.PresenceStreamProvider.CompleteSync(
syncReq.Context, syncReq,
),