mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-06 13:43:09 -06:00
Honour timeouts
This commit is contained in:
parent
07cb8b452a
commit
30fc50d099
|
|
@ -253,6 +253,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
|||
|
||||
// loop until we get some data
|
||||
for {
|
||||
startTime := time.Now()
|
||||
currentPos := rp.Notifier.CurrentPosition()
|
||||
|
||||
// if the since token matches the current positions, wait via the notifier
|
||||
|
|
@ -380,6 +381,10 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
|||
// they weren't always doing, resulting in flakey tests.
|
||||
if !syncReq.Response.HasUpdates() {
|
||||
syncReq.Since = currentPos
|
||||
syncReq.Timeout = syncReq.Timeout - time.Since(startTime)
|
||||
if syncReq.Timeout < 0 {
|
||||
syncReq.Timeout = 0
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue