Skip to content

Commit 4ba2675

Browse files
committed
Assume local catalog eligible if remote flag unknown
1 parent b2aaba4 commit 4ba2675

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Modules/Sources/Yosemite/Tools/POS/POSLocalCatalogEligibilityService.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,23 @@ public actor POSLocalCatalogEligibilityService: POSLocalCatalogEligibilityServic
5050
}
5151

5252
/// Fetch and cache the remote feature flag value
53+
/// Returns cached value if available, otherwise returns true without waiting for network
5354
private func isRemoteCatalogFeatureFlagEnabled() async -> Bool {
5455
if let cached = cachedRemoteFeatureFlag {
5556
return cached
5657
}
57-
let value = await remoteFeatureFlagProvider()
58+
// No cached value yet - assume eligible (true) without waiting for network
59+
// Kick off the fetch in the background to cache for next time
60+
Task { [weak self] in
61+
let value = await self?.remoteFeatureFlagProvider() ?? true
62+
await self?.cacheRemoteFeatureFlag(value)
63+
}
64+
return true
65+
}
66+
67+
/// Cache the remote feature flag value (actor-isolated)
68+
private func cacheRemoteFeatureFlag(_ value: Bool) {
5869
cachedRemoteFeatureFlag = value
59-
return value
6070
}
6171

6272
/// Update POS eligibility and refresh catalog eligibility for the specified site

0 commit comments

Comments
 (0)