Actually return a response with timeout=0

This commit is contained in:
Kegan Dougal 2022-05-18 19:22:54 +01:00
parent 30fc50d099
commit 0cb04005db

View file

@ -381,6 +381,8 @@ 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
// 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)
if syncReq.Timeout < 0 {
syncReq.Timeout = 0
@ -388,6 +390,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
continue
}
}
}
return util.JSONResponse{
Code: http.StatusOK,