disconnect改为异步等待

This commit is contained in:
Pan Qiancheng 2024-12-04 19:19:10 +08:00
parent 1e95c1a8a2
commit 7379c1f3e1
1 changed files with 6 additions and 4 deletions

View File

@ -204,13 +204,15 @@ export class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt extends Backe
if (this.watcherTimerId) {
console.log('取消watcher...');
clearTimeout(this.watcherTimerId);
this.watcherTimerId = undefined
}
for (const job in this.scheduledJobs) {
console.log(`取消定时任务【${job}】...`);
this.scheduledJobs[job]?.cancel();
await this.scheduledJobs[job]?.cancel();
delete this.scheduledJobs[job]
}
clearPorts();
this.dbStore.disconnect();
await clearPorts();
await this.dbStore.disconnect();
}
async execAspect(name: string, headers?: IncomingHttpHeaders, contextString?: string, params?: any): Promise<{
@ -297,7 +299,7 @@ export class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt extends Backe
}
}
}
this.dbStore.disconnect();
await this.dbStore.disconnect();
}
getStore(): DbStore<ED, Cxt> {