Skip to content

Commit

Permalink
Exempt resources having completed historical stage from the prioritiz…
Browse files Browse the repository at this point in the history
…ation mechanism
  • Loading branch information
andersio committed Dec 9, 2024
1 parent a59307d commit 63c7dc0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/VitalHealthKit/HealthKit/VitalHealthKitClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@ extension VitalHealthKitClient {
}

private func prioritizeSync(_ remappedResource: RemappedVitalResource, _ tags: Set<SyncContextTag>) -> Bool {
if storage.historicalStageDone(for: remappedResource) {
// Prioritization only affects historical stage.
// If the resource is done with historical stage, it should not be subject to prioritization.
return true
}

let priority = remappedResource.wrapped.priority
let prerequisites = VitalResource.all.filter { $0.priority < priority }

Expand Down Expand Up @@ -1140,6 +1146,7 @@ extension VitalHealthKitClient {
checkBackgroundUpdates(
isBackgroundEnabled: configuration.backgroundDeliveryEnabled
)
scheduleUnnotifiedResourceRescue()
}

return .success
Expand Down

0 comments on commit 63c7dc0

Please sign in to comment.