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
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:
parent
1af0687423
commit
ac1ef641f5
2 changed files with 2 additions and 2 deletions
|
@ -82,7 +82,7 @@ export class Cache<T> {
|
|||
// Items may have been removed in the meantime or this may be
|
||||
// the initial call for the first key inserted into the cache.
|
||||
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.cache.delete(expiredKey);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ const cache = new Cache<Instance>(
|
|||
if (host == null) return undefined;
|
||||
const res = await Instances.findOneBy({ host });
|
||||
return res ?? undefined;
|
||||
} ,
|
||||
},
|
||||
);
|
||||
|
||||
export async function registerOrFetchInstanceDoc(idnHost: string): Promise<Instance> {
|
||||
|
|
Loading…
Add table
Reference in a new issue