From b966a487be642794de65e73336964e3e3c70fda9 Mon Sep 17 00:00:00 2001 From: Quinn Ftw Date: Sat, 27 Dec 2025 20:02:40 -0800 Subject: [PATCH] fix(lint): enable await-thenable rule and fix sync method calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../server/src/cron/alert.service.ts | 18 +++++++++--------- .../server/src/cron/vps-monitoring.cron.ts | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/features/status-dashboard/server/src/cron/alert.service.ts b/features/status-dashboard/server/src/cron/alert.service.ts index 70839a70b..a38dcbb10 100644 --- a/features/status-dashboard/server/src/cron/alert.service.ts +++ b/features/status-dashboard/server/src/cron/alert.service.ts @@ -39,42 +39,42 @@ export class AlertService { /** * Send resource threshold alert */ - async sendResourceAlert( + sendResourceAlert( resourceType: string, currentValue: number, threshold: number, unit: string, - ): Promise { + ): 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 { 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 { 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); } } diff --git a/features/status-dashboard/server/src/cron/vps-monitoring.cron.ts b/features/status-dashboard/server/src/cron/vps-monitoring.cron.ts index b872e4c18..507d11783 100644 --- a/features/status-dashboard/server/src/cron/vps-monitoring.cron.ts +++ b/features/status-dashboard/server/src/cron/vps-monitoring.cron.ts @@ -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', );