fix: prevent hourly API crash from unhandled CostAggregationService rejection
- setInterval callback lacked .catch() — unhandled Promise rejection crashed the Node.js process exactly 1 hour after startup - AiUsageLog table missing in current DB → aggregateToday() rejects → process.exit(1) in Node 22 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
703703bb56
commit
36903e797e
@ -16,7 +16,7 @@ export class CostAggregationService implements OnModuleInit, OnModuleDestroy {
|
|||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.warn(`Initial cost aggregation failed: ${err.message}`);
|
this.logger.warn(`Initial cost aggregation failed: ${err.message}`);
|
||||||
}
|
}
|
||||||
this.timer = setInterval(() => this.aggregateToday(), AGGREGATE_INTERVAL_MS);
|
this.timer = setInterval(() => this.aggregateToday().catch(err => this.logger.warn(`Hourly cost aggregation failed: ${err.message}`)), AGGREGATE_INTERVAL_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
onModuleDestroy() {
|
onModuleDestroy() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user