mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
Show general last invalidation message
This commit is contained in:
parent
f3fffa56c9
commit
9364a7e654
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@ export interface RedisStats {
|
||||||
memoryCacheLength: number;
|
memoryCacheLength: number;
|
||||||
memoryCacheSize: number;
|
memoryCacheSize: number;
|
||||||
lastInvalidation: number;
|
lastInvalidation: number;
|
||||||
|
lastInvalidationMessage: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RedisSB {
|
interface RedisSB {
|
||||||
|
@ -58,6 +59,7 @@ let writeRequests = 0;
|
||||||
let memoryCacheHits = 0;
|
let memoryCacheHits = 0;
|
||||||
let memoryCacheMisses = 0;
|
let memoryCacheMisses = 0;
|
||||||
let memoryCacheUncachedMisses = 0;
|
let memoryCacheUncachedMisses = 0;
|
||||||
|
let lastInvalidationMessage = 0;
|
||||||
let lastInvalidation = 0;
|
let lastInvalidation = 0;
|
||||||
|
|
||||||
const readResponseTime: number[] = [];
|
const readResponseTime: number[] = [];
|
||||||
|
@ -296,7 +298,8 @@ export function getRedisStats(): RedisStats {
|
||||||
memoryCacheTotalHits: memoryCacheHits / (memoryCacheHits + memoryCacheMisses + memoryCacheUncachedMisses),
|
memoryCacheTotalHits: memoryCacheHits / (memoryCacheHits + memoryCacheMisses + memoryCacheUncachedMisses),
|
||||||
memoryCacheLength: cache?.size ?? 0,
|
memoryCacheLength: cache?.size ?? 0,
|
||||||
memoryCacheSize: cache?.calculatedSize ?? 0,
|
memoryCacheSize: cache?.calculatedSize ?? 0,
|
||||||
lastInvalidation
|
lastInvalidation,
|
||||||
|
lastInvalidationMessage
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +309,7 @@ async function setupCacheClientListener(cacheClient: RedisClientType,
|
||||||
cacheConnectionClientId = String(await cacheClient.clientId());
|
cacheConnectionClientId = String(await cacheClient.clientId());
|
||||||
|
|
||||||
cacheClient.subscribe("__redis__:invalidate", (messages) => {
|
cacheClient.subscribe("__redis__:invalidate", (messages) => {
|
||||||
|
lastInvalidationMessage = Date.now();
|
||||||
if (cache.delete(messages?.[0])) {
|
if (cache.delete(messages?.[0])) {
|
||||||
lastInvalidation = Date.now();
|
lastInvalidation = Date.now();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue