From 2a264db85e08bce4d500e61f50f880ce95f98b29 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 20 Apr 2017 18:01:45 +0100 Subject: [PATCH] Don't tightloop if currentPos is 0 --- .../matrix-org/dendrite/syncserver/sync/requestpool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/syncserver/sync/requestpool.go b/src/github.com/matrix-org/dendrite/syncserver/sync/requestpool.go index 2fee3be6..f3f7bb23 100644 --- a/src/github.com/matrix-org/dendrite/syncserver/sync/requestpool.go +++ b/src/github.com/matrix-org/dendrite/syncserver/sync/requestpool.go @@ -119,6 +119,8 @@ func (rp *RequestPool) waitForEvents(req syncRequest) types.StreamPosition { } func (rp *RequestPool) currentSyncForUser(req syncRequest) (*types.Response, error) { + currentPos := rp.waitForEvents(req) + if req.since == types.StreamPosition(0) { pos, data, err := rp.db.CompleteSync(req.userID, req.limit) if err != nil { @@ -135,8 +137,6 @@ func (rp *RequestPool) currentSyncForUser(req syncRequest) (*types.Response, err return res, nil } - currentPos := rp.waitForEvents(req) - // TODO: handle ignored users data, err := rp.db.IncrementalSync(req.userID, req.since, currentPos, req.limit)