加域申请管理

This commit is contained in:
undefined committed 2020-08-09 11:07:07 +08:00
1 parent 16108993cf
commit c3ff5856e4
16 files changed
+165 -33

No files matched your search

+8 -4
View File
@@ -106,6 +106,13 @@ async function executeCommand(input: string) {
}
}
async function reload(count = 1) {
console.log('Reloading');
await stopWorker();
console.log('Worker stopped');
await startWorker(count);
}
async function messageHandler(worker: cluster.Worker, msg: any) {
if (!msg) msg = worker;
if (msg.event) {
@@ -120,10 +127,7 @@ async function messageHandler(worker: cluster.Worker, msg: any) {
} else if (msg.event === 'stat') {
global.Hydro.stat.reqCount += msg.count;
} else if (msg.event === 'restart') {
console.log('Restarting');
await stopWorker();
console.log('Worker stopped');
await startWorker(msg.count);
await reload(msg.count);
} else if (msg.event === 'run') {
await executeCommand(msg.command);
}