diff options
author | bobzel <zzzman@gmail.com> | 2023-12-04 17:38:36 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-12-04 17:38:36 -0500 |
commit | 2bd239e39264a362d1fbb013ce2613d03247d78e (patch) | |
tree | 6e537dc0c35529c6ee27758a4dec03e23210dbc6 /src/server/DashSession/Session/agents/monitor.ts | |
parent | cf7a7dc34426dacf018ac98a83a9589106ae7256 (diff) |
trying to do version updates on all npm packages.
Diffstat (limited to 'src/server/DashSession/Session/agents/monitor.ts')
-rw-r--r-- | src/server/DashSession/Session/agents/monitor.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/server/DashSession/Session/agents/monitor.ts b/src/server/DashSession/Session/agents/monitor.ts index 9cb5ab576..0f469285e 100644 --- a/src/server/DashSession/Session/agents/monitor.ts +++ b/src/server/DashSession/Session/agents/monitor.ts @@ -1,7 +1,8 @@ import { ExitHandler } from "./applied_session_agent"; import { Configuration, configurationSchema, defaultConfig, Identifiers, colorMapping } from "../utilities/session_config"; import Repl, { ReplAction } from "../utilities/repl"; -import { isWorker, setupMaster, on, Worker, fork } from "cluster"; +import * as _cluster from "cluster"; +import { Worker } from "cluster"; import { manage, MessageHandler, ErrorLike } from "./promisified_ipc_manager"; import { red, cyan, white, yellow, blue } from "colors"; import { exec, ExecOptions } from "child_process"; @@ -10,6 +11,11 @@ import { Utilities } from "../utilities/utilities"; import { readFileSync } from "fs"; import IPCMessageReceiver from "./process_message_router"; import { ServerWorker } from "./server_worker"; +const cluster = _cluster as any; +const isWorker = cluster.isWorker; +const setupMaster = cluster.setupPrimary; +const on = cluster.on; +const fork = cluster.fork; /** * Validates and reads the configuration file, accordingly builds a child process factory @@ -20,7 +26,7 @@ export class Monitor extends IPCMessageReceiver { private finalized = false; private exitHandlers: ExitHandler[] = []; private readonly config: Configuration; - private activeWorker: Worker | undefined; + private activeWorker: Worker| undefined; private key: string | undefined; private repl: Repl; @@ -281,8 +287,11 @@ export class Monitor extends IPCMessageReceiver { pollingIntervalSeconds: polling.intervalSeconds, session_key: key }); - Monitor.IPCManager = manage(this.activeWorker.process, this.handlers); + if (this.activeWorker) { + Monitor.IPCManager = manage(this.activeWorker.process, this.handlers); + } this.mainLog(cyan(`spawned new server worker with process id ${this.activeWorker?.process.pid}`)); + } } |