mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Fix timed out syncs
This commit is contained in:
parent
a588f9061b
commit
722510ac9f
|
|
@ -144,8 +144,6 @@ var waitingSyncRequests = prometheus.NewGauge(
|
|||
// called in a dedicated goroutine for this request. This function will block the goroutine
|
||||
// until a response is ready, or it times out.
|
||||
func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.Device) util.JSONResponse {
|
||||
var syncData *types.Response
|
||||
|
||||
// Extract values from request
|
||||
syncReq, err := newSyncRequest(req, *device, rp.db)
|
||||
if err != nil {
|
||||
|
|
@ -174,11 +172,11 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
|||
select {
|
||||
case <-waitctx.Done(): // Caller gave up
|
||||
waitcancel()
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: syncData}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: syncReq.Response}
|
||||
|
||||
case <-timer.C: // Timeout reached
|
||||
waitcancel()
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: syncData}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: syncReq.Response}
|
||||
|
||||
case <-rp.pduStream.NotifyAfter(waitctx, syncReq.Since.PDUPosition):
|
||||
case <-rp.typingStream.NotifyAfter(waitctx, syncReq.Since.TypingPosition):
|
||||
|
|
|
|||
Loading…
Reference in a new issue