aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext/webSocketMachine.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/xtext/webSocketMachine.ts')
-rw-r--r--subprojects/frontend/src/xtext/webSocketMachine.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/subprojects/frontend/src/xtext/webSocketMachine.ts b/subprojects/frontend/src/xtext/webSocketMachine.ts
index 25689cec..a1eee781 100644
--- a/subprojects/frontend/src/xtext/webSocketMachine.ts
+++ b/subprojects/frontend/src/xtext/webSocketMachine.ts
@@ -1,8 +1,9 @@
1import ms from 'ms';
1import { actions, assign, createMachine, RaiseAction } from 'xstate'; 2import { actions, assign, createMachine, RaiseAction } from 'xstate';
2 3
3const { raise } = actions; 4const { raise } = actions;
4 5
5const ERROR_WAIT_TIMES = [200, 1000, 5000, 30_000]; 6const ERROR_WAIT_TIMES = ['200', '1s', '5s', '30s'].map(ms);
6 7
7export interface WebSocketContext { 8export interface WebSocketContext {
8 webSocketURL: string | undefined; 9 webSocketURL: string | undefined;
@@ -229,9 +230,9 @@ export default createMachine(
229 needsNetwork: ({ webSocketURL }) => !isWebSocketURLLocal(webSocketURL), 230 needsNetwork: ({ webSocketURL }) => !isWebSocketURLLocal(webSocketURL),
230 }, 231 },
231 delays: { 232 delays: {
232 IDLE_TIMEOUT: 300_000, 233 IDLE_TIMEOUT: ms('5m'),
233 OPEN_TIMEOUT: 10_000, 234 OPEN_TIMEOUT: ms('10s'),
234 PING_PERIOD: 10_000, 235 PING_PERIOD: ms('10s'),
235 ERROR_WAIT_TIME: ({ errors: { length: retryCount } }) => { 236 ERROR_WAIT_TIME: ({ errors: { length: retryCount } }) => {
236 const { length } = ERROR_WAIT_TIMES; 237 const { length } = ERROR_WAIT_TIMES;
237 const index = retryCount < length ? retryCount : length - 1; 238 const index = retryCount < length ? retryCount : length - 1;