MCPcopy Create free account
hub / github.com/avoidwork/tenso / cleanupExpiredEntries

Function cleanupExpiredEntries

benchmarks/rate-limiting.js:422–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420 };
421
422 const cleanupExpiredEntries = store => {
423 const currentTime = Math.floor(Date.now() / 1000);
424 const toDelete = [];
425
426 for (const [key, value] of store.entries()) {
427 if (currentTime >= value.reset) {
428 toDelete.push(key);
429 }
430 }
431
432 toDelete.forEach(key => store.delete(key));
433
434 return toDelete.length;
435 };
436
437 suite
438 .add("Rate Cleanup - Small store (100 entries)", () => {

Callers 1

benchmarkRateCleanupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected