fix(lint): enable await-thenable rule and fix sync method calls

Enable @typescript-eslint/await-thenable to catch awaiting non-promises.
Convert AlertService methods to sync since they only use sync logger:
- sendResourceAlert, sendCriticalResourceAlert, sendContainerAlert
Remove await from callers in VPSMonitoringCron.

Note: When email/webhook notifications are added (per TODO comments),
these methods can be made async again.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Quinn Ftw 2025-12-27 20:02:40 -08:00
parent ec0d12a5f9
commit b966a487be
2 changed files with 14 additions and 14 deletions

View file

@ -39,42 +39,42 @@ export class AlertService {
/**
* Send resource threshold alert
*/
async sendResourceAlert(
sendResourceAlert(
resourceType: string,
currentValue: number,
threshold: number,
unit: string,
): Promise<void> {
): void {
const currentFixed = currentValue.toFixed(1);
const message = `${resourceType} usage exceeds threshold: ${currentFixed}${unit} (threshold: ${threshold}${unit})`;
await this.sendAlert(message, 'warning');
this.sendAlert(message, 'warning');
}
/**
* Send critical resource alert
*/
async sendCriticalResourceAlert(
sendCriticalResourceAlert(
resourceType: string,
currentValue: number,
threshold: number,
unit: string,
): Promise<void> {
): void {
const currentFixed = currentValue.toFixed(1);
const message = `CRITICAL: ${resourceType} usage critically high: ${currentFixed}${unit} (threshold: ${threshold}${unit})`;
await this.sendAlert(message, 'critical');
this.sendAlert(message, 'critical');
}
/**
* Send container health alert
*/
async sendContainerAlert(
sendContainerAlert(
containerName: string,
state: string,
health: string | null,
): Promise<void> {
): void {
const healthStatus = health ? ` (health: ${health})` : '';
const message = `Container ${containerName} is ${state}${healthStatus}`;
const severity = state === 'exited' || state === 'dead' || health === 'unhealthy' ? 'critical' : 'warning';
await this.sendAlert(message, severity);
this.sendAlert(message, severity);
}
}

View file

@ -80,7 +80,7 @@ export class VPSMonitoringCron implements OnModuleInit {
// Alert on high CPU usage
const cpuThreshold = this.configService.monitoring.cpuThreshold || 90;
if (resources.cpu.percent > cpuThreshold) {
await this.alertService.sendCriticalResourceAlert(
this.alertService.sendCriticalResourceAlert(
'CPU',
resources.cpu.percent,
cpuThreshold,
@ -91,7 +91,7 @@ export class VPSMonitoringCron implements OnModuleInit {
// Alert on high memory usage
const memoryThreshold = this.configService.monitoring.memoryThreshold || 85;
if (resources.memory.percent > memoryThreshold) {
await this.alertService.sendCriticalResourceAlert(
this.alertService.sendCriticalResourceAlert(
'Memory',
resources.memory.percent,
memoryThreshold,
@ -102,7 +102,7 @@ export class VPSMonitoringCron implements OnModuleInit {
// Alert on high disk usage
const diskThreshold = this.configService.monitoring.diskThreshold || 90;
if (resources.disk.percent > diskThreshold) {
await this.alertService.sendResourceAlert(
this.alertService.sendResourceAlert(
'Disk',
resources.disk.percent,
diskThreshold,
@ -146,7 +146,7 @@ export class VPSMonitoringCron implements OnModuleInit {
container.state === 'exited' ||
container.state === 'dead'
) {
await this.alertService.sendContainerAlert(
this.alertService.sendContainerAlert(
container.name,
container.state,
container.health,
@ -190,7 +190,7 @@ export class VPSMonitoringCron implements OnModuleInit {
);
for (const event of criticalEvents) {
await this.alertService.sendAlert(
this.alertService.sendAlert(
`Docker event: ${event.containerName} - ${event.action}`,
'warning',
);