mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: remove unused vars
This commit is contained in:
2 files changed
+7
-5
No files matched your search
@@ -1,12 +1,9 @@
|
|||||||
import { STATUS } from '@hydrooj/utils/lib/status';
|
import { STATUS } from '@hydrooj/utils/lib/status';
|
||||||
import { Logger } from '../log';
|
|
||||||
import { runQueued } from '../sandbox';
|
import { runQueued } from '../sandbox';
|
||||||
import signals from '../signals';
|
import signals from '../signals';
|
||||||
import { JudgeTask } from '../task';
|
import { JudgeTask } from '../task';
|
||||||
import { parseMemoryMB, parseTimeMS } from '../utils';
|
import { parseMemoryMB, parseTimeMS } from '../utils';
|
||||||
|
|
||||||
const logger = new Logger('judge/run');
|
|
||||||
|
|
||||||
export const judge = async (ctx: JudgeTask) => {
|
export const judge = async (ctx: JudgeTask) => {
|
||||||
ctx.stat.judge = new Date();
|
ctx.stat.judge = new Date();
|
||||||
ctx.next({ status: STATUS.STATUS_COMPILING });
|
ctx.next({ status: STATUS.STATUS_COMPILING });
|
||||||
|
|||||||
@@ -125,9 +125,12 @@ async function adaptResult(result: SandboxResult, params: Parameter): Promise<Sa
|
|||||||
files: result.files,
|
files: result.files,
|
||||||
code: result.exitStatus,
|
code: result.exitStatus,
|
||||||
};
|
};
|
||||||
if (ret.time >= (params.time || 16000)) {
|
if (ret.time > (params.time || 16000)) {
|
||||||
ret.status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
|
ret.status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
|
||||||
}
|
}
|
||||||
|
if (ret.memory > (params.memory || parseMemoryMB(getConfig('memoryMax')))) {
|
||||||
|
ret.status = STATUS.STATUS_MEMORY_LIMIT_EXCEEDED;
|
||||||
|
}
|
||||||
const outname = params.filename ? `${params.filename}.out` : 'stdout';
|
const outname = params.filename ? `${params.filename}.out` : 'stdout';
|
||||||
ret.files = result.files || {};
|
ret.files = result.files || {};
|
||||||
ret.fileIds = result.fileIds || {};
|
ret.fileIds = result.fileIds || {};
|
||||||
@@ -215,7 +218,9 @@ export async function run(execute: string, params?: Parameter): Promise<SandboxA
|
|||||||
const queue = new PQueue({ concurrency: getConfig('concurrency') || getConfig('parallelism') });
|
const queue = new PQueue({ concurrency: getConfig('concurrency') || getConfig('parallelism') });
|
||||||
|
|
||||||
export function runQueued(execute: string, params?: Parameter, priority = 0) {
|
export function runQueued(execute: string, params?: Parameter, priority = 0) {
|
||||||
return queue.add(() => run(execute, params), { priority }) as Promise<SandboxAdaptedResult>;
|
return queue.add(() => {
|
||||||
|
const result = await run(execute, params), { priority }
|
||||||
|
}) as Promise<SandboxAdaptedResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function versionCheck(reportWarn: (str: string) => void, reportError = reportWarn) {
|
export async function versionCheck(reportWarn: (str: string) => void, reportError = reportWarn) {
|
||||||
|
|||||||
Reference in new issue
Block a user