No need for Offline state if we're always in Waiting really

This commit is contained in:
Bruno Windels 2020-05-04 23:42:34 +02:00
parent d70a57a7c9
commit f90b435362

View File

@ -4,7 +4,6 @@ import {ConnectionError} from "../error.js"
import {ObservableValue} from "../../observable/ObservableValue.js";
export const ConnectionStatus = createEnum(
"Offline",
"Waiting",
"Reconnecting",
"Online"
@ -38,8 +37,6 @@ export class Reconnector {
async onRequestFailed(hsApi) {
if (!this._isReconnecting) {
this._setState(ConnectionStatus.Offline);
const onlineStatusSubscription = this._onlineStatus && this._onlineStatus.subscribe(online => {
if (online) {
this.tryNow();
@ -149,7 +146,6 @@ export function tests() {
clock.elapse(2000);
await connectionStatus.waitFor(s => s === ConnectionStatus.Online).promise;
assert.deepEqual(statuses, [
ConnectionStatus.Offline,
ConnectionStatus.Reconnecting,
ConnectionStatus.Waiting,
ConnectionStatus.Reconnecting,