mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
judge: 仅在debug模式下发送性能数据
This commit is contained in:
1 parent
084688f6c1
commit
7d25830ea3
4 files changed
+6
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"version": "2.0.11",
|
||||
"version": "2.0.12",
|
||||
"main": "package.json",
|
||||
"author": "masnn",
|
||||
"os": [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Queue from 'p-queue';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import { CompileError } from '../error';
|
||||
import { copyInDir, parseFilename } from '../utils';
|
||||
@@ -10,7 +11,7 @@ import signals from '../signals';
|
||||
import { check, compileChecker } from '../check';
|
||||
|
||||
const Score = {
|
||||
sum: (a, b) => (a + b),
|
||||
sum: (a: number, b: number) => (a + b),
|
||||
max: Math.max,
|
||||
min: Math.min,
|
||||
};
|
||||
@@ -144,7 +145,7 @@ export const judge = async (ctx) => {
|
||||
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx));
|
||||
await Promise.all(tasks);
|
||||
ctx.stat.done = new Date();
|
||||
ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
ctx.end({
|
||||
status: ctx.total_status,
|
||||
score: ctx.total_score,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { argv } from 'yargs';
|
||||
import { STATUS } from 'hydrooj/dist/model/builtin';
|
||||
import { run } from '../sandbox';
|
||||
import compile from '../compile';
|
||||
@@ -52,7 +53,7 @@ export const judge = async (ctx) => {
|
||||
},
|
||||
});
|
||||
ctx.stat.done = new Date();
|
||||
ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
ctx.end({
|
||||
status,
|
||||
score: status === STATUS.STATUS_ACCEPTED ? 100 : 0,
|
||||
|
||||
@@ -81,7 +81,6 @@ export function compilerText(stdout: string, stderr: string) {
|
||||
const ret = [];
|
||||
if (!EMPTY_STR.test(stdout)) ret.push(stdout);
|
||||
if (!EMPTY_STR.test(stderr)) ret.push(stderr);
|
||||
ret.push('自豪的采用 HydroJudge 进行评测(github.com/hydro-dev/HydroJudge)');
|
||||
return ret.join('\n');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user