mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix submission dispose too early & make submit_answer more efficient (#962)
This commit is contained in:
1 parent
875421dd5b
commit
4b7de2f448
1 file changed
+10
-6
@@ -15,26 +15,30 @@ function judgeCase(c: NormalizedCase) {
|
|||||||
let status = STATUS.STATUS_ACCEPTED;
|
let status = STATUS.STATUS_ACCEPTED;
|
||||||
let message: any = '';
|
let message: any = '';
|
||||||
let score = 0;
|
let score = 0;
|
||||||
|
await using cleanup = {
|
||||||
|
clean: async () => { },
|
||||||
|
async [Symbol.asyncDispose]() { await this.clean(); },
|
||||||
|
};
|
||||||
if (ctx.config.subType === 'multi') {
|
if (ctx.config.subType === 'multi') {
|
||||||
await using res = await runQueued(
|
const res = await runQueued(
|
||||||
'/usr/bin/unzip foo.zip',
|
`/usr/bin/unzip -p foo.zip ${name}`,
|
||||||
{
|
{
|
||||||
stdin: null,
|
stdin: null,
|
||||||
copyIn: { 'foo.zip': ctx.code },
|
copyIn: { 'foo.zip': ctx.code },
|
||||||
copyOutCached: [`${name}?`],
|
|
||||||
time: 1000,
|
time: 1000,
|
||||||
memory: 128,
|
memory: 128,
|
||||||
cacheStdoutAndStderr: true,
|
cacheStdoutAndStderr: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.status === STATUS.STATUS_RUNTIME_ERROR && res.code) {
|
cleanup.clean = async () => await res[Symbol.asyncDispose]();
|
||||||
|
if (res.status === STATUS.STATUS_RUNTIME_ERROR && res.code && res.code !== 11) {
|
||||||
message = { message: 'Unzip failed.' };
|
message = { message: 'Unzip failed.' };
|
||||||
status = STATUS.STATUS_WRONG_ANSWER;
|
status = STATUS.STATUS_WRONG_ANSWER;
|
||||||
} else if (!res.fileIds[name]) {
|
} else if (res.status === STATUS.STATUS_RUNTIME_ERROR && res.code && res.code === 11) {
|
||||||
message = { message: 'File not found.' };
|
message = { message: 'File not found.' };
|
||||||
status = STATUS.STATUS_WRONG_ANSWER;
|
status = STATUS.STATUS_WRONG_ANSWER;
|
||||||
}
|
}
|
||||||
file = { fileId: res.fileIds[name] };
|
file = { fileId: res.fileIds['stdout'] };
|
||||||
}
|
}
|
||||||
if (status === STATUS.STATUS_ACCEPTED) {
|
if (status === STATUS.STATUS_ACCEPTED) {
|
||||||
({ status, score, message } = await checkers[ctx.config.checker_type]({
|
({ status, score, message } = await checkers[ctx.config.checker_type]({
|
||||||
|
|||||||
Reference in new issue
Block a user