fix(telemetry): only shutdown telemetry in stop (#1454)

Reviewed-on: daoyoucloud/tachybase#1454
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: TomyJan <TomyJan6@gmail.com>
Co-committed-by: TomyJan <TomyJan6@gmail.com>
This commit is contained in:
TomyJan 2024-08-12 11:22:24 +08:00 committed by sealday
parent 4a19aa653b
commit 9720c52628
2 changed files with 5 additions and 8 deletions

View File

@ -458,10 +458,6 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
await this.cacheManager.close();
}
if (this.telemetry.started) {
await this.telemetry.shutdown();
}
const oldDb = this.db;
this.init();
@ -485,10 +481,6 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
await this.cacheManager.close();
}
if (this.telemetry.started) {
await this.telemetry.shutdown();
}
const oldDb = this.db;
this.init();

View File

@ -81,6 +81,11 @@ export class Telemetry {
this.started = true;
}
/**
* , NOTE: 一旦调用此方法
* @returns
* @memberof Telemetry
*/
async shutdown() {
await Promise.all([this.trace.shutdown(), this.metric.shutdown()]);
this.started = false;