Skip to content

Commit 1155f4b

Browse files
committed
restore connection status behavior from before
- connectivity got really complicated over the years with hub-websocket and a connection to each project, and multiple NATS connection... but that's all cleaned up now with just one connection. But the code was still complicated. So delete and get back the original behavior, where it doesn't say "DISCONNECTED" until 10 seconds after connection drops and doesn't come back.
1 parent d6c5970 commit 1155f4b

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

src/packages/frontend/app/connection-indicator.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
TOP_BAR_ELEMENT_CLASS,
2222
} from "./top-nav-consts";
2323
import { blur_active_element } from "./util";
24-
import type { ConnectionStatus } from "./store";
2524

2625
interface Props {
2726
height: number; // px
@@ -41,11 +40,8 @@ export const ConnectionIndicator: React.FC<Props> = React.memo(
4140
const { topPaddingIcons, sidePaddingIcons, fontSizeIcons } = pageStyle;
4241

4342
const intl = useIntl();
44-
const hub_status = useTypedRedux("page", "connection_status");
4543
const actions = useActions("page");
46-
const conat = useTypedRedux("page", "conat");
47-
const conatState = conat?.get("state") ?? "disconnected";
48-
const connection_status = worst(hub_status, conatState);
44+
const connection_status = useTypedRedux("page", "connection_status");
4945

5046
const connecting_style: CSS = {
5147
flex: "1",
@@ -116,14 +112,3 @@ export const ConnectionIndicator: React.FC<Props> = React.memo(
116112
},
117113
);
118114

119-
function worst(a?: ConnectionStatus, b?: ConnectionStatus): ConnectionStatus {
120-
if (a == null || b == null) {
121-
return "disconnected";
122-
}
123-
for (const x of ["disconnected", "connecting", "connected"]) {
124-
if (a == x || b == x) {
125-
return x;
126-
}
127-
}
128-
return a;
129-
}

src/packages/frontend/app/monitor-connection.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// state in the page store.
88

99
import { delay } from "awaiting";
10-
1110
import { alert_message } from "@cocalc/frontend/alerts";
1211
import { redux } from "@cocalc/frontend/app-framework";
1312
import { webapp_client } from "@cocalc/frontend/webapp-client";
@@ -16,8 +15,8 @@ import { reuseInFlight } from "@cocalc/util/reuse-in-flight";
1615
import { SITE_NAME } from "@cocalc/util/theme";
1716
import { ConnectionStatus } from "./store";
1817

19-
const DISCONNECTED_STATE_DELAY_MS = 5000;
20-
const CONNECTING_STATE_DELAY_MS = 3000;
18+
const DISCONNECTED_STATE_DELAY_MS = 10000;
19+
const CONNECTING_STATE_DELAY_MS = 5000;
2120

2221
import { isMobile } from "../feature";
2322

0 commit comments

Comments
 (0)