From cc19063c79dc5281d0248cf405f57175e5eedc2a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 May 2020 23:50:12 +0200 Subject: [PATCH] set timeout on /sync request as long running requests run higher risk of getting wedged --- src/matrix/Sync.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix/Sync.js b/src/matrix/Sync.js index 673bed82..b772ad2f 100644 --- a/src/matrix/Sync.js +++ b/src/matrix/Sync.js @@ -83,7 +83,8 @@ export class Sync { // TODO: this should be interruptable by stop, we can reuse _currentRequest syncFilterId = (await this._hsApi.createFilter(this._session.user.id, {room: {state: {lazy_load_members: true}}}).response()).filter_id; } - this._currentRequest = this._hsApi.sync(syncToken, syncFilterId, timeout); + const totalRequestTimeout = timeout + (80 * 1000); // same as riot-web, don't get stuck on wedged long requests + this._currentRequest = this._hsApi.sync(syncToken, syncFilterId, timeout, {timeout: totalRequestTimeout}); const response = await this._currentRequest.response(); syncToken = response.next_batch; const storeNames = this._storage.storeNames;