events: try nostrdb cache if we don't have one in-memory
Our nip10 logic looks for notes only in the in-memory cache. This means sometimes threads don't get fully loaded if for whatever reason it's in the nostrdb cache but not in-memory. Ideally we would just remove our in-memory cache, but for now let's just hack it so it falls back to nostrdb and makes an owned note. Changelog-Fixed: Fixed threads not loading sometimes Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -218,7 +218,16 @@ class EventCache {
|
||||
*/
|
||||
|
||||
func lookup(_ evid: NoteId) -> NostrEvent? {
|
||||
return events[evid]
|
||||
if let ev = events[evid] {
|
||||
return ev
|
||||
}
|
||||
|
||||
if let ev = self.ndb.lookup_note(evid)?.unsafeUnownedValue?.to_owned() {
|
||||
events[ev.id] = ev
|
||||
return ev
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func insert(_ ev: NostrEvent) {
|
||||
|
||||
Reference in New Issue
Block a user