Fix cache miss on metadata
This commit is contained in:
parent
b08e3b36f0
commit
e1d2f9ff3e
|
@ -13,7 +13,7 @@ export interface MetaRecord {
|
||||||
groups: CharacterGroup[] | null;
|
groups: CharacterGroup[] | null;
|
||||||
friends: SimpleCharacter[] | null;
|
friends: SimpleCharacter[] | null;
|
||||||
guestbook: Guestbook | null;
|
guestbook: Guestbook | null;
|
||||||
lastFetched: Date | null;
|
lastMetaFetched: Date | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ export class ProfileCache extends AsyncCache<CharacterCacheRecord> {
|
||||||
cacheRecord.added = new Date(pd.firstSeen * 1000);
|
cacheRecord.added = new Date(pd.firstSeen * 1000);
|
||||||
|
|
||||||
cacheRecord.meta = {
|
cacheRecord.meta = {
|
||||||
lastFetched: pd.lastMetaFetched ? new Date(pd.lastMetaFetched) : null,
|
lastMetaFetched: pd.lastMetaFetched ? new Date(pd.lastMetaFetched) : null,
|
||||||
groups: pd.groups,
|
groups: pd.groups,
|
||||||
friends: pd.friends,
|
friends: pd.friends,
|
||||||
images: pd.images,
|
images: pd.images,
|
||||||
|
|
|
@ -303,7 +303,7 @@
|
||||||
await core.cache.profileCache.registerMeta(
|
await core.cache.profileCache.registerMeta(
|
||||||
name,
|
name,
|
||||||
{
|
{
|
||||||
lastFetched: new Date(),
|
lastMetaFetched: new Date(),
|
||||||
groups: this.groups,
|
groups: this.groups,
|
||||||
friends: this.friends,
|
friends: this.friends,
|
||||||
guestbook: this.guestbook,
|
guestbook: this.guestbook,
|
||||||
|
@ -365,8 +365,8 @@
|
||||||
if (
|
if (
|
||||||
(cache && !skipCache)
|
(cache && !skipCache)
|
||||||
&& (cache.meta)
|
&& (cache.meta)
|
||||||
&& (cache.meta.lastFetched)
|
&& (cache.meta.lastMetaFetched)
|
||||||
&& (Date.now() - cache.meta.lastFetched.getTime() > CHARACTER_META_CACHE_EXPIRE)
|
&& (Date.now() - cache.meta.lastMetaFetched.getTime() > CHARACTER_META_CACHE_EXPIRE)
|
||||||
) {
|
) {
|
||||||
this.guestbook = cache.meta.guestbook;
|
this.guestbook = cache.meta.guestbook;
|
||||||
this.friends = cache.meta.friends;
|
this.friends = cache.meta.friends;
|
||||||
|
|
Loading…
Reference in New Issue