Guard reconcile reentrancy and deleted-routine duplication; cache exercise info parsing
This commit is contained in:
@@ -407,7 +407,7 @@ final class SyncEngine {
|
||||
/// when the engine isn't connected.
|
||||
@discardableResult
|
||||
func duplicate(routine: Routine) async -> String? {
|
||||
guard store != nil else { return nil }
|
||||
guard store != nil, routine.isLive else { return nil }
|
||||
|
||||
var doc = RoutineDocument(from: routine)
|
||||
doc.id = ULID.make()
|
||||
@@ -767,6 +767,10 @@ final class SyncEngine {
|
||||
/// changes accumulated while the app was closed are picked up.
|
||||
private func reconcile() async {
|
||||
guard let store, let tombstones else { return }
|
||||
// Drop a reconcile that overlaps a running one — redundant, since the
|
||||
// running pass covers the same tree and the metadata observer picks up
|
||||
// anything newer.
|
||||
guard !isSyncing else { return }
|
||||
isSyncing = true
|
||||
defer { isSyncing = false }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user