judge: merge processTestdata

This commit is contained in:
undefined committed 2022-05-15 23:12:18 +08:00
1 parent e4b916037c
commit b74f6b64f8
15 files changed
+78 -152

No files matched your search

+7
View File
@@ -1,5 +1,6 @@
import cac from 'cac';
import fs from 'fs-extra';
import PQueue from 'p-queue';
import { ParseEntry } from 'shell-quote';
import { STATUS } from '@hydrooj/utils/lib/status';
import { getConfig } from './config';
@@ -191,3 +192,9 @@ export async function run(execute: string, params?: Parameter): Promise<SandboxA
}
return await adaptResult(result, params);
}
const queue = new PQueue({ concurrency: getConfig('parallelism') });
export function runQueued(execute: string, params?: Parameter, priority = 0) {
return queue.add(() => run(execute, params), { priority });
}