commit 7cde5cb2ff5f2bde944c630da92f48d4ca9e5f52
parent 8177ebe430f8e839caef9ff38f912983de765133
Author: Michael Camilleri <[email protected]>
Date: Tue, 26 May 2026 02:24:35 +0900
Disable polling while engagement is live
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Crossmate/CrossmateApp.swift b/Crossmate/CrossmateApp.swift
@@ -368,8 +368,9 @@ private extension UIApplication {
/// Loads a game when navigated to.
private struct PuzzleDisplayView: View {
/// Tight cadence used while a collaborator burst is in progress (a silent
- /// push has arrived recently). Most updates ride the push path directly;
- /// this poll just covers the rare cases where CKSyncEngine drops one.
+ /// push has arrived recently). Most updates ride the push/socket path
+ /// directly; this poll just covers the rare cases where CKSyncEngine drops
+ /// one or no engagement socket is live.
private static let activePollingInterval: Duration = .seconds(5)
/// Long safety-belt cadence used when no pushes have arrived for a while.
/// Trades latency-on-missed-push for far fewer CloudKit reads at idle.
@@ -743,6 +744,9 @@ private struct PuzzleDisplayView: View {
await services.publishReadCursor(for: gameID, mode: .activeLease)
lastReadLeaseRefresh = now
}
+ if services.engagementStatus.isLive(gameID: gameID) {
+ continue
+ }
await services.freshenPuzzleGrid(gameID: gameID, scope: scope, reason: .poll)
}
}