remove start value, can be hardcoded for now

also fix params in wrong order this way
This commit is contained in:
Bruno Windels 2020-04-22 20:48:25 +02:00
parent f826258c75
commit 08b1c02af7
3 changed files with 6 additions and 5 deletions

View File

@ -115,7 +115,7 @@ export class SessionContainer {
this._status.set(LoadStatus.Loading);
this._reconnector = new Reconnector({
onlineStatus: this._onlineStatus,
delay: new ExponentialRetryDelay(2000, this._clock.createTimeout),
retryDelay: new ExponentialRetryDelay(this._clock.createTimeout),
createMeasure: this._clock.createMeasure
});
const hsApi = new HomeServerApi({

View File

@ -1,7 +1,8 @@
import {AbortError} from "../../utils/error.js";
export class ExponentialRetryDelay {
constructor(createTimeout, start = 2000) {
constructor(createTimeout) {
const start = 2000;
this._start = start;
this._current = start;
this._createTimeout = createTimeout;
@ -49,7 +50,7 @@ export function tests() {
return {
"test sequence": async assert => {
const clock = new MockClock();
const retryDelay = new ExponentialRetryDelay(clock.createTimeout, 2000);
const retryDelay = new ExponentialRetryDelay(clock.createTimeout);
let promise;
assert.strictEqual(retryDelay.nextValue, 2000);

View File

@ -137,7 +137,7 @@ export function tests() {
const clock = new MockClock();
const {createMeasure} = clock;
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 {connectionStatus} = reconnector;
const statuses = [];
@ -162,7 +162,7 @@ export function tests() {
const clock = new MockClock();
const {createMeasure} = clock;
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 {connectionStatus} = reconnector;
reconnector.onRequestFailed(createHsApiMock(1));