fix(tests): fix tests
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user