From 52e2d3203e98835b0549430c3adfddb35aeb35f1 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 7 May 2020 00:04:41 +0200 Subject: [PATCH] also make filter request interruptable --- src/matrix/Sync.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/matrix/Sync.js b/src/matrix/Sync.js index b772ad2f..de079e4d 100644 --- a/src/matrix/Sync.js +++ b/src/matrix/Sync.js @@ -80,8 +80,8 @@ export class Sync { async _syncRequest(syncToken, timeout) { let {syncFilterId} = this._session; if (typeof syncFilterId !== "string") { - // 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.createFilter(this._session.user.id, {room: {state: {lazy_load_members: true}}}); + syncFilterId = (await this._currentRequest.response()).filter_id; } 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});