forked from mystiq/hydrogen-web
set timeout on /sync request
as long running requests run higher risk of getting wedged
This commit is contained in:
parent
06fc3101e8
commit
cc19063c79
1 changed files with 2 additions and 1 deletions
|
@ -83,7 +83,8 @@ export class Sync {
|
||||||
// TODO: this should be interruptable by stop, we can reuse _currentRequest
|
// 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;
|
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();
|
const response = await this._currentRequest.response();
|
||||||
syncToken = response.next_batch;
|
syncToken = response.next_batch;
|
||||||
const storeNames = this._storage.storeNames;
|
const storeNames = this._storage.storeNames;
|
||||||
|
|
Loading…
Reference in a new issue