release: v4.1.0

This commit is contained in:
Amruth Pillai
2024-05-05 14:55:06 +02:00
parent 68252c35fc
commit e87b05a93a
282 changed files with 11461 additions and 10713 deletions

View File

@ -1,11 +1,8 @@
import { Controller, Get, NotFoundException } from "@nestjs/common";
import { ApiTags } from "@nestjs/swagger";
import { HealthCheck, HealthCheckService } from "@nestjs/terminus";
import { RedisService } from "@songkeys/nestjs-redis";
import { RedisHealthIndicator } from "@songkeys/nestjs-redis-health";
import { configSchema } from "../config/schema";
import { UtilsService } from "../utils/utils.service";
import { BrowserHealthIndicator } from "./browser.health";
import { DatabaseHealthIndicator } from "./database.health";
import { StorageHealthIndicator } from "./storage.health";
@ -18,9 +15,6 @@ export class HealthController {
private readonly database: DatabaseHealthIndicator,
private readonly browser: BrowserHealthIndicator,
private readonly storage: StorageHealthIndicator,
private readonly redisService: RedisService,
private readonly redis: RedisHealthIndicator,
private readonly utils: UtilsService,
) {}
private run() {
@ -28,20 +22,13 @@ export class HealthController {
() => this.database.isHealthy(),
() => this.storage.isHealthy(),
() => this.browser.isHealthy(),
() => {
return this.redis.checkHealth("redis", {
type: "redis",
timeout: 1000,
client: this.redisService.getClient(),
});
},
]);
}
@Get()
@HealthCheck()
check() {
return this.utils.getCachedOrSet(`health:check`, () => this.run(), 1000 * 30); // 30 seconds
return this.run();
}
@Get("environment")

View File

@ -1,6 +1,5 @@
import { Module } from "@nestjs/common";
import { TerminusModule } from "@nestjs/terminus";
import { RedisHealthModule } from "@songkeys/nestjs-redis-health";
import { PrinterModule } from "../printer/printer.module";
import { StorageModule } from "../storage/storage.module";
@ -10,7 +9,7 @@ import { HealthController } from "./health.controller";
import { StorageHealthIndicator } from "./storage.health";
@Module({
imports: [TerminusModule, PrinterModule, StorageModule, RedisHealthModule],
imports: [TerminusModule, PrinterModule, StorageModule],
controllers: [HealthController],
providers: [DatabaseHealthIndicator, BrowserHealthIndicator, StorageHealthIndicator],
})

View File

@ -14,8 +14,8 @@ export class StorageHealthIndicator extends HealthIndicator {
await this.storageService.bucketExists();
return this.getStatus("storage", true);
} catch (error) {
return this.getStatus("storage", false, { message: error.message });
} catch (error: unknown) {
return this.getStatus("storage", false, { message: (error as Error).message });
}
}
}