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
b54c22cb84
commit
9247b71b5f
11 files changed
+123
-69
No files matched your search
+3
-2
@@ -24,7 +24,6 @@ async function fork(args) {
|
||||
|
||||
async function entry(config) {
|
||||
if (config.entry) {
|
||||
// TODO newProcess
|
||||
if (config.newProcess) {
|
||||
const process = await fork([`--entry=${config.entry}`]);
|
||||
await new Promise((resolve) => {
|
||||
@@ -43,7 +42,8 @@ async function stopWorker() {
|
||||
}
|
||||
|
||||
async function startWorker(cnt) {
|
||||
for (let i = 0; i < cnt; i++) await fork();
|
||||
await fork(['--firstWorker']);
|
||||
for (let i = 1; i < cnt; i++) await fork();
|
||||
}
|
||||
|
||||
async function executeCommand(input) {
|
||||
@@ -120,6 +120,7 @@ async function load() {
|
||||
await entry({ entry: argv.entry });
|
||||
console.log(`Worker ${process.pid} Started as ${argv.entry}`);
|
||||
} else {
|
||||
if (argv.firstWorker) cluster.isFirstWorker = true;
|
||||
console.log(`Worker ${process.pid} Starting`);
|
||||
await entry({ entry: 'worker' });
|
||||
console.log(`Worker ${process.pid} Started`);
|
||||
|
||||
Reference in new issue
Block a user