Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SharingGRDBCore/CloudKit/SyncEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
previousRecordTypeByTableName: [String: RecordType],
currentRecordTypeByTableName: [String: RecordType]
) async throws {
let pendingRecordZoneChanges = try await userDatabase.read { db in
let pendingRecordZoneChanges = try await metadatabase.read { db in
try PendingRecordZoneChange
.select(\.pendingRecordZoneChange)
.fetchAll(db)
Expand Down
4 changes: 1 addition & 3 deletions Sources/SharingGRDBCore/Internal/UserDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ package struct UserDatabase {
_ updates: @Sendable (Database) throws -> T
) async throws -> T {
try await database.read { db in
try SyncEngine.$_isSynchronizingChanges.withValue(true) {
try updates(db)
}
try updates(db)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import CloudKit
import CustomDump
import InlineSnapshotTesting
import SharingGRDB
import SnapshotTestingCustomDump
import Testing

extension BaseCloudKitTests {
@MainActor
final class UnattachedSyncEngineTests: @unchecked Sendable {
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
@Test func start() async throws {
let database = try DatabasePool(path: "\(NSTemporaryDirectory())\(UUID())")
_ = try await SyncEngine(
container: MockCloudContainer(
containerIdentifier: "iCloud.co.pointfree.Testing",
privateCloudDatabase: MockCloudDatabase(databaseScope: .private),
sharedCloudDatabase: MockCloudDatabase(databaseScope: .shared)
),
userDatabase: UserDatabase(database: database),
tables: []
)
}
}
}
Loading