speed optimizations: cache network_pull_date in memory and ensure writes on background queue

This commit is contained in:
Bryan Montz
2023-05-25 08:20:41 -05:00
parent 91113fbc6d
commit 7259641e26
2 changed files with 46 additions and 19 deletions

View File

@@ -69,8 +69,7 @@ class Profiles {
}
// then disk
guard let persisted_profile = database.get_persisted(id: id),
let pull_date = persisted_profile.network_pull_date else {
guard let pull_date = database.get_network_pull_date(id: id) else {
return false
}
return Date.now.timeIntervalSince(pull_date) < Profiles.db_freshness_threshold