Mark closures in DNUpdate as @Sendable

This commit is contained in:
Caleb Jasik 2025-02-25 13:15:24 -06:00
parent 8e9b5fcc4a
commit df4c3a51b8
No known key found for this signature in database

View file

@ -6,7 +6,7 @@ class DNUpdater {
private let timer = RepeatingTimer(timeInterval: 15 * 60) // 15 * 60 is 15 minutes
private let log = Logger(subsystem: "net.defined.mobileNebula", category: "DNUpdater")
func updateAll(onUpdate: @escaping (Site) -> Void) {
func updateAll(onUpdate: @Sendable @escaping (Site) -> Void) {
_ = SiteList { (sites, _) -> Void in
// NEVPN seems to force us onto the main thread and we are about to make network calls that
// could block for a while. Push ourselves onto another thread to avoid blocking the UI.
@ -23,21 +23,21 @@ class DNUpdater {
}
}
func updateAllLoop(onUpdate: @escaping (Site) -> Void) {
func updateAllLoop(onUpdate: @Sendable @escaping (Site) -> Void) {
timer.eventHandler = {
self.updateAll(onUpdate: onUpdate)
}
timer.resume()
}
func updateSingleLoop(site: Site, onUpdate: @escaping (Site) -> Void) {
func updateSingleLoop(site: Site, onUpdate: @Sendable @escaping (Site) -> Void) {
timer.eventHandler = {
self.updateSite(site: site, onUpdate: onUpdate)
}
timer.resume()
}
func updateSite(site: Site, onUpdate: @escaping (Site) -> Void) {
func updateSite(site: Site, onUpdate: @Sendable @escaping (Site) -> Void) {
do {
if !site.managed {
return