fix: ensure old instances are cleaned up during application reinitialization (#6524)

* fix: getConnection called after connection closed error

* fix: ensure old instances are cleaned up during application reinitialization
This commit is contained in:
gchust 2025-03-22 09:25:43 +08:00 committed by GitHub
parent f7a81858ea
commit 369754f8f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -572,6 +572,10 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
this.log.info('app reinitializing');
// trigger the stop events to make sure old instances are cleaned up
await this.emitAsync('beforeStop');
await this.emitAsync('afterStop');
if (this.cacheManager) {
await this.cacheManager.close();
}