Dont kill flipper server when no clients connect and is dev

Summary: This is quite annoying and causes may un needed reboots of flipper server while developing

Reviewed By: antonk52

Differential Revision: D47949842

fbshipit-source-id: c2f18e16a4933e4209e74f51978cb7d05b80ee11
This commit is contained in:
Luke De Feo
2023-08-01 10:32:29 -07:00
committed by Facebook GitHub Bot
parent 09042ec5d6
commit eaf5b4c246

View File

@@ -17,6 +17,7 @@ import {
SystemError, SystemError,
getLogger, getLogger,
CompanionEventWebSocketMessage, CompanionEventWebSocketMessage,
isProduction,
} from 'flipper-common'; } from 'flipper-common';
import {FlipperServerImpl} from '../FlipperServerImpl'; import {FlipperServerImpl} from '../FlipperServerImpl';
import {RawData, WebSocketServer} from 'ws'; import {RawData, WebSocketServer} from 'ws';
@@ -242,7 +243,7 @@ export function attachSocketServer(
* If, after 15 min, there are no more connected clients, we exit the process. * If, after 15 min, there are no more connected clients, we exit the process.
*/ */
disconnectTimeout = setTimeout(() => { disconnectTimeout = setTimeout(() => {
if (numberOfConnectedClients === 0) { if (numberOfConnectedClients === 0 && isProduction()) {
console.info('Shutdown as no clients are currently connected'); console.info('Shutdown as no clients are currently connected');
process.exit(0); process.exit(0);
} }