mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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);
|
||||
|
||||
Reference in new issue
Block a user