server: fix cache expiring
Some checks failed
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline failed

This commit is contained in:
Johann150 2024-03-30 08:39:47 +01:00
parent 1af0687423
commit ac1ef641f5
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 2 additions and 2 deletions

View file

@ -82,7 +82,7 @@ export class Cache<T> {
// Items may have been removed in the meantime or this may be // Items may have been removed in the meantime or this may be
// the initial call for the first key inserted into the cache. // the initial call for the first key inserted into the cache.
const [expiredKey, expiredValue] = this.cache.entries().next().value; const [expiredKey, expiredValue] = this.cache.entries().next().value;
if (expiredValue.date + this.lifetime >= Date.now()) { if (expiredValue.date + this.lifetime <= Date.now()) {
// This item is due for expiration, so remove it. // This item is due for expiration, so remove it.
this.cache.delete(expiredKey); this.cache.delete(expiredKey);
} }