Skip to content

Commit b6627cc

Browse files
committed
up reconnection attempts
1 parent eed094b commit b6627cc

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

app/commonVars.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ export const instListSubscription: IfcPVWSRequest = {
99
type: PVWSRequestType.subscribe,
1010
pvs: [instListPV],
1111
};
12+
13+
export const webSocketReconnectInterval = 5000; // ms
14+
export const webSocketReconnectAttempts = 100000;

app/components/InstrumentData.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ import {
1919
yesToBoolean,
2020
} from "@/app/components/Instrument";
2121
import useWebSocket from "react-use-websocket";
22-
import { instListPV, instListSubscription, socketURL } from "@/app/commonVars";
22+
import {
23+
instListPV,
24+
instListSubscription,
25+
socketURL,
26+
webSocketReconnectAttempts,
27+
webSocketReconnectInterval,
28+
} from "@/app/commonVars";
2329
import {
2430
dehex_and_decompress,
2531
instListFromBytes,
@@ -176,8 +182,8 @@ export function InstrumentData({ instrumentName }: { instrumentName: string }) {
176182
},
177183
share: true,
178184
retryOnError: true,
179-
reconnectInterval: 5000,
180-
reconnectAttempts: 1000,
185+
reconnectInterval: webSocketReconnectInterval,
186+
reconnectAttempts: webSocketReconnectAttempts,
181187
});
182188

183189
if (!currentInstrument) {

app/components/InstrumentsDisplay.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import {
77
PVWSRequestType,
88
} from "@/app/types";
99
import useWebSocket from "react-use-websocket";
10-
import { instListPV, instListSubscription, socketURL } from "@/app/commonVars";
10+
import {
11+
instListPV,
12+
instListSubscription,
13+
socketURL,
14+
webSocketReconnectAttempts,
15+
webSocketReconnectInterval,
16+
} from "@/app/commonVars";
1117
import { instListFromBytes } from "@/app/components/dehex_and_decompress";
1218
import TargetStation from "@/app/components/TargetStation";
1319
import ScienceGroup from "@/app/components/ScienceGroup";
@@ -116,8 +122,8 @@ export default function InstrumentsDisplay({
116122
},
117123
share: true,
118124
retryOnError: true,
119-
reconnectInterval: 5000,
120-
reconnectAttempts: 1000,
125+
reconnectInterval: webSocketReconnectInterval,
126+
reconnectAttempts: webSocketReconnectAttempts,
121127
});
122128

123129
return (

0 commit comments

Comments
 (0)