mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 03:57:06 +03:00
Fix memory cache invalidation not invalidating every item
This commit is contained in:
@@ -361,17 +361,20 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
// To tell it to not save the result of this currently running request
|
// To tell it to not save the result of this currently running request
|
||||||
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