mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: compile: add asyncDispose
This commit is contained in:
3 files changed
+4
-1
No files matched your search
@@ -37,6 +37,7 @@ export default async function compile(
|
|||||||
execute,
|
execute,
|
||||||
copyIn: { ...copyIn, [target]: { fileId: fileIds[target] } },
|
copyIn: { ...copyIn, [target]: { fileId: fileIds[target] } },
|
||||||
clean: async () => await cleanup(),
|
clean: async () => await cleanup(),
|
||||||
|
[Symbol.asyncDispose]: async () => await cleanup(),
|
||||||
_cacheable: target,
|
_cacheable: target,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -44,5 +45,6 @@ export default async function compile(
|
|||||||
execute,
|
execute,
|
||||||
copyIn: { ...copyIn, [lang.code_file]: code },
|
copyIn: { ...copyIn, [lang.code_file]: code },
|
||||||
clean: () => Promise.resolve(null),
|
clean: () => Promise.resolve(null),
|
||||||
|
[Symbol.asyncDispose]: () => Promise.resolve(null),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ export interface Execute {
|
|||||||
execute: string;
|
execute: string;
|
||||||
clean: () => Promise<any>;
|
clean: () => Promise<any>;
|
||||||
copyIn: Record<string, CopyInFile>;
|
copyIn: Record<string, CopyInFile>;
|
||||||
|
[Symbol.asyncDispose]: () => Promise<any>;
|
||||||
_cacheable?: string;
|
_cacheable?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class JudgeTask {
|
|||||||
end: (data: Partial<JudgeResultBody>) => void;
|
end: (data: Partial<JudgeResultBody>) => void;
|
||||||
env: Record<string, string>;
|
env: Record<string, string>;
|
||||||
callbackCache?: TestCase[];
|
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) {
|
constructor(public session: Session, public request: JudgeRequest) {
|
||||||
this.stat.receive = new Date();
|
this.stat.receive = new Date();
|
||||||
|
|||||||
Reference in new issue
Block a user