forked from mystiq/hydrogen-web
remove start value, can be hardcoded for now
also fix params in wrong order this way
This commit is contained in:
parent
f826258c75
commit
08b1c02af7
3 changed files with 6 additions and 5 deletions
|
@ -115,7 +115,7 @@ export class SessionContainer {
|
||||||
this._status.set(LoadStatus.Loading);
|
this._status.set(LoadStatus.Loading);
|
||||||
this._reconnector = new Reconnector({
|
this._reconnector = new Reconnector({
|
||||||
onlineStatus: this._onlineStatus,
|
onlineStatus: this._onlineStatus,
|
||||||
delay: new ExponentialRetryDelay(2000, this._clock.createTimeout),
|
retryDelay: new ExponentialRetryDelay(this._clock.createTimeout),
|
||||||
createMeasure: this._clock.createMeasure
|
createMeasure: this._clock.createMeasure
|
||||||
});
|
});
|
||||||
const hsApi = new HomeServerApi({
|
const hsApi = new HomeServerApi({
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import {AbortError} from "../../utils/error.js";
|
import {AbortError} from "../../utils/error.js";
|
||||||
|
|
||||||
export class ExponentialRetryDelay {
|
export class ExponentialRetryDelay {
|
||||||
constructor(createTimeout, start = 2000) {
|
constructor(createTimeout) {
|
||||||
|
const start = 2000;
|
||||||
this._start = start;
|
this._start = start;
|
||||||
this._current = start;
|
this._current = start;
|
||||||
this._createTimeout = createTimeout;
|
this._createTimeout = createTimeout;
|
||||||
|
@ -49,7 +50,7 @@ export function tests() {
|
||||||
return {
|
return {
|
||||||
"test sequence": async assert => {
|
"test sequence": async assert => {
|
||||||
const clock = new MockClock();
|
const clock = new MockClock();
|
||||||
const retryDelay = new ExponentialRetryDelay(clock.createTimeout, 2000);
|
const retryDelay = new ExponentialRetryDelay(clock.createTimeout);
|
||||||
let promise;
|
let promise;
|
||||||
|
|
||||||
assert.strictEqual(retryDelay.nextValue, 2000);
|
assert.strictEqual(retryDelay.nextValue, 2000);
|
||||||
|
|
|
@ -137,7 +137,7 @@ export function tests() {
|
||||||
const clock = new MockClock();
|
const clock = new MockClock();
|
||||||
const {createMeasure} = clock;
|
const {createMeasure} = clock;
|
||||||
const onlineStatus = new ObservableValue(false);
|
const onlineStatus = new ObservableValue(false);
|
||||||
const retryDelay = new ExponentialRetryDelay(clock.createTimeout, 2000);
|
const retryDelay = new ExponentialRetryDelay(clock.createTimeout);
|
||||||
const reconnector = new Reconnector({retryDelay, onlineStatus, createMeasure});
|
const reconnector = new Reconnector({retryDelay, onlineStatus, createMeasure});
|
||||||
const {connectionStatus} = reconnector;
|
const {connectionStatus} = reconnector;
|
||||||
const statuses = [];
|
const statuses = [];
|
||||||
|
@ -162,7 +162,7 @@ export function tests() {
|
||||||
const clock = new MockClock();
|
const clock = new MockClock();
|
||||||
const {createMeasure} = clock;
|
const {createMeasure} = clock;
|
||||||
const onlineStatus = new ObservableValue(false);
|
const onlineStatus = new ObservableValue(false);
|
||||||
const retryDelay = new ExponentialRetryDelay(clock.createTimeout, 2000);
|
const retryDelay = new ExponentialRetryDelay(clock.createTimeout);
|
||||||
const reconnector = new Reconnector({retryDelay, onlineStatus, createMeasure});
|
const reconnector = new Reconnector({retryDelay, onlineStatus, createMeasure});
|
||||||
const {connectionStatus} = reconnector;
|
const {connectionStatus} = reconnector;
|
||||||
reconnector.onRequestFailed(createHsApiMock(1));
|
reconnector.onRequestFailed(createHsApiMock(1));
|
||||||
|
|
Loading…
Reference in a new issue