fix(tests): fix tests

This commit is contained in:
Juergen Kunz
2025-06-23 08:38:14 +00:00
parent 1aead55296
commit be58700a2f
14 changed files with 153 additions and 107 deletions

View File

@ -274,10 +274,16 @@ export class MetricsCollector implements IMetrics {
lastUpdate: now
});
// Cleanup old request timestamps (keep last minute only)
if (this.requestTimestamps.length > 1000) {
// Cleanup old request timestamps
if (this.requestTimestamps.length > 5000) {
// First try to clean up old timestamps (older than 1 minute)
const cutoff = now - 60000;
this.requestTimestamps = this.requestTimestamps.filter(ts => ts > cutoff);
// If still too many, enforce hard cap of 5000 most recent
if (this.requestTimestamps.length > 5000) {
this.requestTimestamps = this.requestTimestamps.slice(-5000);
}
}
}