mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&judge: also enable performance mode when bulk rejudge
This commit is contained in:
1 parent
d468b52a7a
commit
5a02010120
4 files changed
+11
-6
No files matched your search
@@ -155,7 +155,8 @@ export default class Hydro {
|
|||||||
getNext(t: JudgeTask) {
|
getNext(t: JudgeTask) {
|
||||||
return (data: Partial<JudgeResultBody>) => {
|
return (data: Partial<JudgeResultBody>) => {
|
||||||
log.debug('Next: %o', data);
|
log.debug('Next: %o', data);
|
||||||
if (getConfig('performance') && data.case && !data.compilerText && !data.message) {
|
const performanceMode = getConfig('performance') || t.meta.rejudge || t.meta.hackRejudge;
|
||||||
|
if (performanceMode && data.case && !data.compilerText && !data.message) {
|
||||||
t.callbackCache ||= [];
|
t.callbackCache ||= [];
|
||||||
t.callbackCache.push(data.case);
|
t.callbackCache.push(data.case);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -441,8 +441,8 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
|||||||
const priority = await record.submissionPriority(this.user._id, -10000 - rdocs.length * 5 - 50);
|
const priority = await record.submissionPriority(this.user._id, -10000 - rdocs.length * 5 - 50);
|
||||||
await record.reset(domainId, rdocs.map((rdoc) => rdoc._id), true);
|
await record.reset(domainId, rdocs.map((rdoc) => rdoc._id), true);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
record.judge(domainId, rdocs.filter((i) => i.contest).map((i) => i._id), priority, { detail: false }),
|
record.judge(domainId, rdocs.filter((i) => i.contest).map((i) => i._id), priority, { detail: false }, { rejudge: true }),
|
||||||
record.judge(domainId, rdocs.filter((i) => !i.contest).map((i) => i._id), priority, {}),
|
record.judge(domainId, rdocs.filter((i) => !i.contest).map((i) => i._id), priority, {}, { rejudge: true }),
|
||||||
]);
|
]);
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,6 +336,7 @@ export interface RecordDoc {
|
|||||||
export interface JudgeMeta {
|
export interface JudgeMeta {
|
||||||
problemOwner: number;
|
problemOwner: number;
|
||||||
hackRejudge?: string;
|
hackRejudge?: string;
|
||||||
|
rejudge?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeRequest extends Omit<RecordDoc, '_id' | 'testCases'> {
|
export interface JudgeRequest extends Omit<RecordDoc, '_id' | 'testCases'> {
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default class RecordModel {
|
|||||||
contest?: ObjectID,
|
contest?: ObjectID,
|
||||||
input?: string,
|
input?: string,
|
||||||
files?: Record<string, string>,
|
files?: Record<string, string>,
|
||||||
type: 'judge' | 'contest' | 'pretest' | 'hack',
|
type: 'judge' | 'rejudge' | 'contest' | 'pretest' | 'hack',
|
||||||
} = { type: 'judge' },
|
} = { type: 'judge' },
|
||||||
) {
|
) {
|
||||||
const data: RecordDoc = {
|
const data: RecordDoc = {
|
||||||
@@ -138,14 +138,17 @@ export default class RecordModel {
|
|||||||
};
|
};
|
||||||
if (args.contest) data.contest = args.contest;
|
if (args.contest) data.contest = args.contest;
|
||||||
if (args.files) data.files = args.files;
|
if (args.files) data.files = args.files;
|
||||||
if (args.type === 'pretest') {
|
if (args.type === 'rejudge') {
|
||||||
|
args.type = 'judge';
|
||||||
|
data.rejudged = true;
|
||||||
|
} else if (args.type === 'pretest') {
|
||||||
data.input = args.input || '';
|
data.input = args.input || '';
|
||||||
data.contest = new ObjectID('000000000000000000000000');
|
data.contest = new ObjectID('000000000000000000000000');
|
||||||
}
|
}
|
||||||
const res = await RecordModel.coll.insertOne(data);
|
const res = await RecordModel.coll.insertOne(data);
|
||||||
if (addTask) {
|
if (addTask) {
|
||||||
const priority = await RecordModel.submissionPriority(uid, args.type === 'pretest' ? -20 : (args.type === 'contest' ? 50 : 0));
|
const priority = await RecordModel.submissionPriority(uid, args.type === 'pretest' ? -20 : (args.type === 'contest' ? 50 : 0));
|
||||||
await RecordModel.judge(domainId, res.insertedId, priority, args.type === 'contest' ? { detail: false } : {});
|
await RecordModel.judge(domainId, res.insertedId, priority, args.type === 'contest' ? { detail: false } : {}, { rejudge: data.rejudged });
|
||||||
}
|
}
|
||||||
return res.insertedId;
|
return res.insertedId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user