mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
加域申请管理
This commit is contained in:
1 parent
16108993cf
commit
c3ff5856e4
16 files changed
+165
-33
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user