fix threading issue

This commit is contained in:
ryanzhao 2021-09-14 13:33:27 +10:00
parent 3c4a19e30d
commit 17b15f2cd9
2 changed files with 3 additions and 2 deletions

View File

@ -152,7 +152,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv
// Re-populate snode pool if needed
SnodeAPI.getSnodePool().retainUntilComplete()
// Onion request path countries cache
DispatchQueue.global(qos: .utility).async {
DispatchQueue.global(qos: .utility).sync {
let _ = IP2Country.shared.populateCacheIfNeeded()
}
// Get default open group rooms if needed

View File

@ -46,7 +46,8 @@ final class IP2Country {
}
@objc func populateCacheIfNeededAsync() {
IP2Country.workQueue.async {
// This has to be sync since the `countryNamesCache` dict doesn't like async access
IP2Country.workQueue.sync {
let _ = self.populateCacheIfNeeded()
}
}