refactor: user cache

This commit is contained in:
Kieran 2023-04-04 19:35:22 +01:00
parent 6c55f42dd1
commit 03446aa50d
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 2 additions and 4 deletions

View File

@ -49,7 +49,6 @@ class UserProfileCache extends FeedCache<MetadataCache> {
*/
async update(m: MetadataCache) {
const existing = this.getFromCache(m.pubkey);
const refresh = existing && existing.loaded < m.loaded;
const updateType = (() => {
if (!existing) {
return "new_profile";
@ -57,7 +56,7 @@ class UserProfileCache extends FeedCache<MetadataCache> {
if (existing.created < m.created) {
return "updated_profile";
}
if (refresh) {
if (existing && existing.loaded < m.loaded) {
return "refresh_profile";
}
return "no_change";
@ -73,9 +72,8 @@ class UserProfileCache extends FeedCache<MetadataCache> {
await svc.load();
m.zapService = svc.zapperPubkey;
} catch {
console.debug("Failed to load LNURL for zapper pubkey", lnurl);
console.warn("Failed to load LNURL for zapper pubkey", lnurl);
}
// ignored
}
}