import "./config/env" ; import "./config/proxy" ; import throng from "throng" ; import { isNodeProd } from "./util/isNodeEnv" ; import { listenToMicrosLifecycle } from "./services/micros/lifecycle" ; import { ClusterCommand , sendCommandToCluster } from "./services/cluster/send-command" ; import { probot } from "./worker/app" ; import { initializeSentry } from "./config/sentry" ; import { listenForClusterCommand } from "./services/cluster/listen-command" ; import { start , stop } from "./worker/startup" ; const initialize = ( ) => { initializeSentry ( ) ; probot . start ( ) ; } ; if ( isNodeProd ( ) ) { throng ( { worker : ( ) => { initialize ( ) ; listenForClusterCommand ( ClusterCommand . start , start ) ; listenForClusterCommand ( ClusterCommand . stop , stop ) ; } , master : ( ) => { listenToMicrosLifecycle ( ( ) => sendCommandToCluster ( ClusterCommand . start ) , ( ) => sendCommandToCluster ( ClusterCommand . stop ) ) ; } , lifetime : Infinity } ) ; } else { initialize ( ) ; start ( ) ; }