mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 20:17:02 +03:00
Fix memory cache invalidation not invalidating every item
This commit is contained in:
@@ -361,10 +361,11 @@ async function setupCacheClientListener(cacheClient: RedisClientType,
|
|||||||
|
|
||||||
cacheConnectionClientId = String(await cacheClient.clientId());
|
cacheConnectionClientId = String(await cacheClient.clientId());
|
||||||
|
|
||||||
cacheClient.subscribe("__redis__:invalidate", (messages) => {
|
cacheClient.subscribe("__redis__:invalidate", (keys) => {
|
||||||
const key = messages?.[0];
|
if (keys) {
|
||||||
|
|
||||||
lastInvalidationMessage = Date.now();
|
lastInvalidationMessage = Date.now();
|
||||||
|
|
||||||
|
for (const key of keys) {
|
||||||
if (cache.delete(key)) {
|
if (cache.delete(key)) {
|
||||||
lastInvalidation = Date.now();
|
lastInvalidation = Date.now();
|
||||||
}
|
}
|
||||||
@@ -373,6 +374,8 @@ async function setupCacheClientListener(cacheClient: RedisClientType,
|
|||||||
if (key && activeRequestPromises[key] !== undefined) {
|
if (key && activeRequestPromises[key] !== undefined) {
|
||||||
resetKeys.add(key);
|
resetKeys.add(key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}).catch(Logger.error);
|
}).catch(Logger.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user