mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-09 22:42:58 +00:00
Don't tightloop if currentPos is 0
This commit is contained in:
parent
cb5081b332
commit
2a264db85e
@ -119,6 +119,8 @@ func (rp *RequestPool) waitForEvents(req syncRequest) types.StreamPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rp *RequestPool) currentSyncForUser(req syncRequest) (*types.Response, error) {
|
func (rp *RequestPool) currentSyncForUser(req syncRequest) (*types.Response, error) {
|
||||||
|
currentPos := rp.waitForEvents(req)
|
||||||
|
|
||||||
if req.since == types.StreamPosition(0) {
|
if req.since == types.StreamPosition(0) {
|
||||||
pos, data, err := rp.db.CompleteSync(req.userID, req.limit)
|
pos, data, err := rp.db.CompleteSync(req.userID, req.limit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -135,8 +137,6 @@ func (rp *RequestPool) currentSyncForUser(req syncRequest) (*types.Response, err
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPos := rp.waitForEvents(req)
|
|
||||||
|
|
||||||
// TODO: handle ignored users
|
// TODO: handle ignored users
|
||||||
|
|
||||||
data, err := rp.db.IncrementalSync(req.userID, req.since, currentPos, req.limit)
|
data, err := rp.db.IncrementalSync(req.userID, req.since, currentPos, req.limit)
|
||||||
|
Loading…
Reference in New Issue
Block a user