bug: release onEvent for profile cache

This commit is contained in:
Kieran 2023-03-29 15:08:05 +01:00
parent 79c88df292
commit 8462a7c04f
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -56,7 +56,7 @@ class ProfileLoaderService {
const q = System.Query<PubkeyReplaceableNoteStore>(PubkeyReplaceableNoteStore, sub); const q = System.Query<PubkeyReplaceableNoteStore>(PubkeyReplaceableNoteStore, sub);
// never release this callback, it will stop firing anyway after eose // never release this callback, it will stop firing anyway after eose
q.onEvent(async ev => { const releaseOnEvent = q.onEvent(async ev => {
for (const e of ev) { for (const e of ev) {
const profile = mapEventToProfile(e); const profile = mapEventToProfile(e);
if (profile) { if (profile) {
@ -79,6 +79,7 @@ class ProfileLoaderService {
}, 5_000); }, 5_000);
}); });
releaseOnEvent();
const couldNotFetch = [...missing].filter(a => !results.some(b => b.pubkey === a)); const couldNotFetch = [...missing].filter(a => !results.some(b => b.pubkey === a));
if (couldNotFetch.length > 0) { if (couldNotFetch.length > 0) {
console.debug("No profiles: ", couldNotFetch); console.debug("No profiles: ", couldNotFetch);