judge: compile: add asyncDispose

This commit is contained in:
undefined committed 2025-04-14 19:21:35 +08:00
1 parent e31b84d29e
commit 302d03fe08
3 files changed
+4 -1

No files matched your search

+2
View File
@@ -37,6 +37,7 @@ export default async function compile(
execute,
copyIn: { ...copyIn, [target]: { fileId: fileIds[target] } },
clean: async () => await cleanup(),
[Symbol.asyncDispose]: async () => await cleanup(),
_cacheable: target,
};
}
@@ -44,5 +45,6 @@ export default async function compile(
execute,
copyIn: { ...copyIn, [lang.code_file]: code },
clean: () => Promise.resolve(null),
[Symbol.asyncDispose]: () => Promise.resolve(null),
};
}
+1
View File
@@ -8,6 +8,7 @@ export interface Execute {
execute: string;
clean: () => Promise<any>;
copyIn: Record<string, CopyInFile>;
[Symbol.asyncDispose]: () => Promise<any>;
_cacheable?: string;
}
+1 -1
View File
@@ -42,7 +42,7 @@ export class JudgeTask {
end: (data: Partial<JudgeResultBody>) => void;
env: Record<string, string>;
callbackCache?: TestCase[];
compileCache: Record<string, Pick<Execute, 'execute' | 'copyIn'>> = {};
compileCache: Record<string, Pick<Execute, 'execute' | 'copyIn' | typeof Symbol.asyncDispose>> = {};
constructor(public session: Session, public request: JudgeRequest) {
this.stat.receive = new Date();