fix addon load

This commit is contained in:
undefined committed 2020-07-24 12:33:23 +08:00
1 parent 2e4c818c37
commit 92335d8529
9 files changed
+80 -38

No files matched your search

+9 -2
View File
@@ -54,7 +54,12 @@ async function fork(args: string[] = []) {
return cluster.fork();
}
async function entry(config: any) {
interface EntryConfig {
entry: string,
newProcess?: boolean,
}
async function entry(config: EntryConfig) {
if (config.entry) {
if (config.newProcess) {
const sargv = [`--entry=${config.entry}`];
@@ -74,6 +79,8 @@ async function entry(config: any) {
return null;
}
export type Entry = typeof entry;
async function stopWorker() {
cluster.disconnect();
}
@@ -201,7 +208,7 @@ export async function load() {
console.log(global.addons);
if (argv.entry) {
console.log(`Worker ${process.pid} Starting as ${argv.entry}`);
await entry({ entry: argv.entry });
await entry({ entry: argv.entry as string });
console.log(`Worker ${process.pid} Started as ${argv.entry}`);
} else {
if (argv.firstWorker) cluster.isFirstWorker = true;