FIX: in dev mode, sockets won't be closed to prevent conflicts with live-reloading

This commit is contained in:
kharhamel 2020-11-10 15:24:02 +01:00
parent 1080328afa
commit 5a1147866c
3 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,7 @@ const CPU_OVERHEAT_THRESHOLD = Number(process.env.CPU_OVERHEAT_THRESHOLD) || 80;
const JITSI_URL : string|undefined = (process.env.JITSI_URL === '') ? undefined : process.env.JITSI_URL;
const JITSI_ISS = process.env.JITSI_ISS || '';
const SECRET_JITSI_KEY = process.env.SECRET_JITSI_KEY || '';
const DEV_MODE = process.env.DEV_MODE || false;
export {
SECRET_KEY,
@ -21,6 +22,7 @@ export {
GROUP_RADIUS,
ALLOW_ARTILLERY,
CPU_OVERHEAT_THRESHOLD,
DEV_MODE,
JITSI_URL,
JITSI_ISS,
SECRET_JITSI_KEY

View File

@ -1,5 +1,6 @@
import {ExSocketInterface} from "_Model/Websocket/ExSocketInterface";
import {BatchMessage, ErrorMessage, ServerToClientMessage, SubMessage} from "../Messages/generated/messages_pb";
import {DEV_MODE} from "../Enum/EnvironmentVariable";
export function emitInBatch(socket: ExSocketInterface, payload: SubMessage): void {
socket.batchedMessages.addPayload(payload);
@ -52,6 +53,7 @@ export function emitError(Client: ExSocketInterface, message: string): void {
export const pongMaxInterval = 30000; // the maximum duration (in ms) between pongs before we shutdown the connexion.
export function refresLogoutTimerOnPong(ws: ExSocketInterface): void {
if (DEV_MODE) return; //this feature is disabled in dev mode as it clashes with live reload.
if(ws.pongTimeout) clearTimeout(ws.pongTimeout);
ws.pongTimeout = setTimeout(() => {
ws.close();

View File

@ -78,6 +78,7 @@ services:
ADMIN_API_TOKEN: "$ADMIN_API_TOKEN"
JITSI_URL: $JITSI_URL
JITSI_ISS: $JITSI_ISS
DEV_MODE: "1"
volumes:
- ./back:/usr/src/app
labels: