perf: don't continuously attempt to fetch old profiles

Changelog-Changed: Save bandwidth by only fetching new profiles after a certain amount of time
This commit is contained in:
William Casarin
2023-10-23 10:31:47 +08:00
parent bbccc27a26
commit 76508dbbfd
12 changed files with 86 additions and 48 deletions

View File

@@ -123,8 +123,9 @@ class ProfileModel: ObservableObject, Equatable {
break
//notify(.notice, notice)
case .eose:
let txn = NdbTxn(ndb: damus.ndb)
if resp.subid == sub_id {
load_profiles(profiles_subid: prof_subid, relay_id: relay_id, load: .from_events(events.events), damus_state: damus)
load_profiles(profiles_subid: prof_subid, relay_id: relay_id, load: .from_events(events.events), damus_state: damus, txn: txn)
}
progress += 1
break