Skip to content

Commit e67e800

Browse files
committed
feat(cubestore-driver): Introduce CUBEJS_CUBESTORE_NO_HEART_BEAT_TIMEOUT env
1 parent cd15022 commit e67e800

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/cubejs-backend-shared/src/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,9 @@ const variables: Record<string, (...args: any) => any> = {
13181318
cubeStoreMaxConnectRetries: () => get('CUBEJS_CUBESTORE_MAX_CONNECT_RETRIES')
13191319
.default('5')
13201320
.asInt(),
1321+
cubeStoreNoHeartBeatTimeout: () => get('CUBEJS_CUBESTORE_NO_HEART_BEAT_TIMEOUT')
1322+
.default('30')
1323+
.asInt(),
13211324

13221325
// Redis
13231326
redisPoolMin: () => get('CUBEJS_REDIS_POOL_MIN')

packages/cubejs-cubestore-driver/src/WebSocketConnection.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export class WebSocketConnection {
1616

1717
protected maxConnectRetries: number;
1818

19+
protected noHeartBeatTimeout: number;
20+
1921
protected currentConnectionTry: number;
2022

2123
protected webSocket: any;
@@ -26,6 +28,7 @@ export class WebSocketConnection {
2628
this.url = url;
2729
this.messageCounter = 1;
2830
this.maxConnectRetries = getEnv('cubeStoreMaxConnectRetries');
31+
this.noHeartBeatTimeout = getEnv('cubeStoreNoHeartBeatTimeout');
2932
this.currentConnectionTry = 0;
3033
}
3134

@@ -39,7 +42,7 @@ export class WebSocketConnection {
3942
webSocket.ping();
4043
}
4144

42-
if (new Date().getTime() - webSocket.lastHeartBeat.getTime() > 30000) {
45+
if (new Date().getTime() - webSocket.lastHeartBeat.getTime() > this.noHeartBeatTimeout * 1000) {
4346
webSocket.close();
4447
}
4548
}, 5000);

0 commit comments

Comments
 (0)