commit 467133e1f5018ebeb561670a3b899f54f2dce13b
parent 6d4ec291b5791ec93708398a9b8562848e7ab4db
Author: Michael Camilleri <[email protected]>
Date: Sun, 17 May 2026 16:10:00 +0900
Trace the ping send path in enqueuePing
Diffstat
| M | Crossmate/Sync/SyncEngine.swift | | | 31 | +++++++++++++++++++++++++++++-- |
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/Crossmate/Sync/SyncEngine.swift b/Crossmate/Sync/SyncEngine.swift
@@ -370,9 +370,28 @@ actor SyncEngine {
let title = Self.notificationTitle(for: entity)
return (info, title)
}
- guard let zoneAndTitle else { return }
+ guard let zoneAndTitle else {
+ Task {
+ await trace(
+ "ping send: SKIPPED kind=\(kind.rawValue) " +
+ "scope=\(scope?.rawValue ?? "none") game=\(gameID.uuidString) " +
+ "— no zone info (game not yet synced/shared on this device)"
+ )
+ }
+ return
+ }
let engine = zoneAndTitle.info.scope == 1 ? sharedEngine : privateEngine
- guard let engine else { return }
+ guard let engine else {
+ Task {
+ await trace(
+ "ping send: SKIPPED kind=\(kind.rawValue) " +
+ "scope=\(scope?.rawValue ?? "none") game=\(gameID.uuidString) " +
+ "— no CKSyncEngine for " +
+ "\(zoneAndTitle.info.scope == 1 ? "shared" : "private") scope"
+ )
+ }
+ return
+ }
let deviceID = RecordSerializer.localDeviceID
let eventTimestampMs = Int64(Date().timeIntervalSince1970 * 1000)
let recordName = RecordSerializer.recordName(
@@ -394,6 +413,14 @@ actor SyncEngine {
)
let recordID = CKRecord.ID(recordName: recordName, zoneID: zoneAndTitle.info.zoneID)
engine.state.add(pendingRecordZoneChanges: [.saveRecord(recordID)])
+ Task {
+ await trace(
+ "ping send: enqueued kind=\(kind.rawValue) " +
+ "scope=\(scope?.rawValue ?? "none") game=\(gameID.uuidString) " +
+ "target=\(zoneAndTitle.info.scope == 1 ? "shared" : "private") " +
+ "zone=\(zoneAndTitle.info.zoneID.zoneName) record=\(recordName)"
+ )
+ }
Task { try? await engine.sendChanges() }
}