forked from Kieran/snort
refactor: user cache
This commit is contained in:
parent
6c55f42dd1
commit
03446aa50d
@ -49,7 +49,6 @@ class UserProfileCache extends FeedCache<MetadataCache> {
|
|||||||
*/
|
*/
|
||||||
async update(m: MetadataCache) {
|
async update(m: MetadataCache) {
|
||||||
const existing = this.getFromCache(m.pubkey);
|
const existing = this.getFromCache(m.pubkey);
|
||||||
const refresh = existing && existing.loaded < m.loaded;
|
|
||||||
const updateType = (() => {
|
const updateType = (() => {
|
||||||
if (!existing) {
|
if (!existing) {
|
||||||
return "new_profile";
|
return "new_profile";
|
||||||
@ -57,7 +56,7 @@ class UserProfileCache extends FeedCache<MetadataCache> {
|
|||||||
if (existing.created < m.created) {
|
if (existing.created < m.created) {
|
||||||
return "updated_profile";
|
return "updated_profile";
|
||||||
}
|
}
|
||||||
if (refresh) {
|
if (existing && existing.loaded < m.loaded) {
|
||||||
return "refresh_profile";
|
return "refresh_profile";
|
||||||
}
|
}
|
||||||
return "no_change";
|
return "no_change";
|
||||||
@ -73,9 +72,8 @@ class UserProfileCache extends FeedCache<MetadataCache> {
|
|||||||
await svc.load();
|
await svc.load();
|
||||||
m.zapService = svc.zapperPubkey;
|
m.zapService = svc.zapperPubkey;
|
||||||
} catch {
|
} catch {
|
||||||
console.debug("Failed to load LNURL for zapper pubkey", lnurl);
|
console.warn("Failed to load LNURL for zapper pubkey", lnurl);
|
||||||
}
|
}
|
||||||
// ignored
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user