From a60a212a10f2eb62f1c7f1275b3cd01f7c38fb23 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Tue, 2 Feb 2021 15:32:15 -0800 Subject: [PATCH] Tweak cache thresholds --- lib/cwmp.ts | 4 ++-- lib/local-cache.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cwmp.ts b/lib/cwmp.ts index 2125b6d..7c0362d 100644 --- a/lib/cwmp.ts +++ b/lib/cwmp.ts @@ -208,7 +208,7 @@ async function writeResponse( sessionContext.extendLock = now + 10000; await cache.acquireLock( `cwmp_session_${sessionContext.deviceId}`, - sessionContext.timeout + 10000, + sessionContext.timeout + 15000, 0, sessionContext.sessionId ); @@ -1130,7 +1130,7 @@ async function processRequest( sessionContext.extendLock = sessionContext.timestamp + 10000; await cache.acquireLock( `cwmp_session_${sessionContext.deviceId}`, - sessionContext.timeout + 10000, + sessionContext.timeout + 15000, 0, sessionContext.sessionId ); diff --git a/lib/local-cache.ts b/lib/local-cache.ts index 7b87ac0..e5207e0 100644 --- a/lib/local-cache.ts +++ b/lib/local-cache.ts @@ -50,8 +50,8 @@ interface Snapshot { ui: UiConfig; } -const REFRESH = 3000; -const EVICT_TIMEOUT = 60000; +const REFRESH = 5000; +const EVICT_TIMEOUT = 120000; const snapshots = new Map(); let currentSnapshot: string = null; @@ -398,7 +398,7 @@ async function refresh(): Promise { return; } - const lockToken = await cache.acquireLock("presets_hash_lock", 4000, 4000); + const lockToken = await cache.acquireLock("presets_hash_lock", 5000, 5000); const res = await Promise.all([ fetchPresets(),