mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
judge: fix hosts dispose
This commit is contained in:
1 parent
31f107354c
commit
d483531b0e
2 files changed
+7
-3
No files matched your search
@@ -29,13 +29,13 @@ declare global {
|
||||
}
|
||||
}
|
||||
global.onDestroy ||= [];
|
||||
global.hosts ||= [];
|
||||
global.hosts ||= {};
|
||||
let exit = false;
|
||||
|
||||
const terminate = async () => {
|
||||
log.info('正在保存数据');
|
||||
try {
|
||||
await Promise.all(global.hosts.map((f) => f.dispose?.()));
|
||||
await Promise.all(Object.values(global.hosts).map((f) => f.dispose?.()));
|
||||
process.exit(1);
|
||||
} catch (e) {
|
||||
if (exit) process.exit(1);
|
||||
|
||||
@@ -51,7 +51,11 @@ export async function judge({
|
||||
},
|
||||
});
|
||||
};
|
||||
const usrAns = (answers[key]?.toString() || '').trim();
|
||||
if (!answers[key]) {
|
||||
report(STATUS.STATUS_WRONG_ANSWER, 0, 'No answer');
|
||||
continue;
|
||||
}
|
||||
const usrAns = answers[key].toString().trim();
|
||||
if (ansInfo instanceof Array) {
|
||||
const fullScore = (+ansInfo[1]) || 0;
|
||||
const stdAns = ansInfo[0];
|
||||
|
||||
Reference in new issue
Block a user