19 lines
523 B
TypeScript
19 lines
523 B
TypeScript
import type { DependencyHealthDto } from '../../http-contracts/src/health.dto';
|
|
|
|
/** 将计划内关闭的依赖表达为 disabled,避免误报 unavailable 或尝试建立连接。 */
|
|
export class DisabledHealthClient {
|
|
constructor(private readonly detail: string) {}
|
|
|
|
async check(): Promise<DependencyHealthDto> {
|
|
return { status: 'disabled', detail: this.detail };
|
|
}
|
|
|
|
async close(): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
async onModuleDestroy(): Promise<void> {
|
|
await this.close();
|
|
}
|
|
}
|