From 39aaa25f3f41de2afdaa8cc41a7e518de435e9bd Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Sun, 3 Jul 2022 11:00:48 +0700 Subject: [PATCH] perf: SimpleDataStore --- controllers/utils/SimpleDataStore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/utils/SimpleDataStore.js b/controllers/utils/SimpleDataStore.js index e48357c..24d2503 100644 --- a/controllers/utils/SimpleDataStore.js +++ b/controllers/utils/SimpleDataStore.js @@ -52,14 +52,14 @@ class SimpleDataStore { } getStalest () { - let stalest = null + let stalest = [null, { stratval: Infinity }] switch (this.#strategy) { // both "lastGetTime" and "getsCount" simply must find lowest value // to determine the stalest entry case STRATEGIES[0]: case STRATEGIES[1]: for (const entry of this.#store) { - if (!stalest || entry[1].stratval < stalest[1].stratval) { + if (entry[1].stratval < stalest[1].stratval) { stalest = entry } }