commit ceeed13065267d9693c6e9f3fad216ffbbdf84a8
parent d6dc855b680028881e2c3bb9a7f445b6c219d5d2
Author: Michael Camilleri <[email protected]>
Date: Thu, 25 Jun 2026 04:31:35 +0900
Tweak log line when counting zones
Diffstat:
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/Crossmate/Sync/CloudQuery.swift b/Crossmate/Sync/CloudQuery.swift
@@ -509,19 +509,23 @@ extension SyncEngine {
let known = knownZones(forScope: scopeValue, in: ctx)
let knownKeys = Set(known.map { "\($0.zoneID.ownerName)|\($0.zoneID.zoneName)" })
- let candidates: [CKRecordZone.ID] = serverZones
+ // Server zones not already tracked as a game or friend zone.
+ let untracked = serverZones
.map(\.zoneID)
.filter { id in
id != CKRecordZone.ID.default &&
- !knownKeys.contains("\(id.ownerName)|\(id.zoneName)") &&
- // Skip zones this probe can never resolve to a game: the
- // account-scoped zone and the private-DB archive backups of
- // finished shared games. Archive records arrive through the
- // engine's own fetchedRecordZoneChanges, not this Game query, so
- // probing them here only re-fans a wasted query on every pass.
- id.zoneName != RecordSerializer.accountZoneID.zoneName &&
- !Archive.isArchiveZone(id.zoneName)
+ !knownKeys.contains("\(id.ownerName)|\(id.zoneName)")
}
+ // Of those, skip the ones this probe can never resolve to a game: the
+ // account-scoped zone and the private-DB archive backups of finished
+ // shared games. Archive records arrive through the engine's own
+ // fetchedRecordZoneChanges, not this Game query, so probing them here
+ // only re-fans a wasted query on every pass.
+ let candidates = untracked.filter { id in
+ id.zoneName != RecordSerializer.accountZoneID.zoneName &&
+ !Archive.isArchiveZone(id.zoneName)
+ }
+ let nonGameCount = untracked.count - candidates.count
guard !candidates.isEmpty else {
// Count non-default server zones so the figure matches what the
@@ -531,9 +535,12 @@ extension SyncEngine {
let serverNonDefault = serverZones.lazy
.filter { $0.zoneID != .default }
.count
+ // Name the account/archive zones held back above so the figures
+ // reconcile at a glance: known games + non-game = server.
+ let nonGameSuffix = nonGameCount > 0 ? ", non-game=\(nonGameCount)" : ""
await trace(
"\(label) zone discovery: nothing new " +
- "(server=\(serverNonDefault), known=\(known.count))"
+ "(server=\(serverNonDefault), known=\(known.count)\(nonGameSuffix))"
)
return 0
}