set timeout on /sync request

as long running requests run higher risk of getting wedged
This commit is contained in:
Bruno Windels 2020-05-06 23:50:12 +02:00
parent 06fc3101e8
commit cc19063c79

View file

@ -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;