Fix npub search fails on the first try

Co-authored-by: William Casarin <jb55@jb55.com>
Changelog-Fixed: Fix npub search fails on the first try
Closes: #1044
Closes: #1100
This commit is contained in:
Bryan Montz
2023-05-05 21:57:47 -05:00
committed by William Casarin
parent a007e18add
commit f78eeb1f22
3 changed files with 13 additions and 4 deletions

View File

@@ -751,8 +751,16 @@ func find_event(state: DamusState, evid: String, search_type: SearchType, find_f
break
case .event(_, let ev):
has_event = true
callback(ev)
state.pool.unsubscribe(sub_id: subid)
if search_type == .profile && ev.known_kind == .metadata {
process_metadata_event(events: state.events, our_pubkey: state.pubkey, profiles: state.profiles, ev: ev) {
callback(ev)
}
} else {
callback(ev)
}
case .eose:
if !has_event {
attempts += 1