diff --git a/src/github.com/matrix-org/dendrite/syncapi/sync/requestpool.go b/src/github.com/matrix-org/dendrite/syncapi/sync/requestpool.go index 4c510c128..548703738 100644 --- a/src/github.com/matrix-org/dendrite/syncapi/sync/requestpool.go +++ b/src/github.com/matrix-org/dendrite/syncapi/sync/requestpool.go @@ -45,6 +45,8 @@ func NewRequestPool(db *storage.SyncServerDatabase, n *Notifier, adb *accounts.D // 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 *authtypes.Device) util.JSONResponse { + var syncData *types.Response + // Extract values from request logger := util.GetLogger(req.Context()) userID := device.UserID @@ -65,7 +67,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtype // If this is an initial sync or timeout=0 we return immediately if syncReq.since == nil || syncReq.timeout == 0 { - syncData, err := rp.currentSyncForUser(*syncReq, currPos) + syncData, err = rp.currentSyncForUser(*syncReq, currPos) if err != nil { return httputil.LogThenError(req, err) } @@ -103,7 +105,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtype // of calculating the sync only to get timed out before we // can respond - syncData, err := rp.currentSyncForUser(*syncReq, currPos) + syncData, err = rp.currentSyncForUser(*syncReq, currPos) if err != nil { return httputil.LogThenError(req, err) }