mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 14:13:11 -06:00
Actually return a response with timeout=0
This commit is contained in:
parent
30fc50d099
commit
0cb04005db
|
|
@ -381,6 +381,8 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
||||||
// they weren't always doing, resulting in flakey tests.
|
// they weren't always doing, resulting in flakey tests.
|
||||||
if !syncReq.Response.HasUpdates() {
|
if !syncReq.Response.HasUpdates() {
|
||||||
syncReq.Since = currentPos
|
syncReq.Since = currentPos
|
||||||
|
// do not loop again if the ?timeout= is 0 as that means "return immediately"
|
||||||
|
if syncReq.Timeout > 0 {
|
||||||
syncReq.Timeout = syncReq.Timeout - time.Since(startTime)
|
syncReq.Timeout = syncReq.Timeout - time.Since(startTime)
|
||||||
if syncReq.Timeout < 0 {
|
if syncReq.Timeout < 0 {
|
||||||
syncReq.Timeout = 0
|
syncReq.Timeout = 0
|
||||||
|
|
@ -388,6 +390,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue