commit 597942cfe821911723bece22672a3eef5a4cb131
parent 7254faea4a7006d183da73595d4f86130eeca413
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 00:40:56 +0200
util: evict the oldest performance stat, not the slowest
The table is sorted descending by duration, so splicing index 0 dropped the
slowest entry, which is the one worth keeping.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/taler-util/src/performance.ts b/packages/taler-util/src/performance.ts
@@ -261,8 +261,10 @@ export namespace PerformanceTable {
* Keep performance table under size limit.
*/
function rotate(tab: PerformanceTable, type: PerformanceStatType) {
- if (tab[type]!!.length > MAX_PERFORMANCE_TABLE_SIZE) {
- tab[type]?.splice(0, 1);
+ if (tab[type]!.length > MAX_PERFORMANCE_TABLE_SIZE) {
+ // Sorted descending by duration, so index 0 is the slowest entry.
+ // Drop the tail instead.
+ tab[type]?.splice(MAX_PERFORMANCE_TABLE_SIZE);
}
}
}