Skip to content

Commit 39494c4

Browse files
committed
Always save updated clock to remote
1 parent df428c3 commit 39494c4

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

Sources/ParseCareKit/ParseRemote.swift

+5-13
Original file line numberDiff line numberDiff line change
@@ -389,22 +389,14 @@ public class ParseRemote: OCKRemoteSynchronizable {
389389
localClock: OCKRevisionRecord.KnowledgeVector,
390390
completion: @escaping (Error?) -> Void) {
391391
Task {
392-
guard shouldIncrementClock else {
393-
await self.remoteStatus.updateClock(parseClock)
394-
await self.remoteStatus.notSynchronzing()
395-
Logger.pushRevisions.debug("Finished pushing revisions")
396-
DispatchQueue.main.async {
397-
self.parseRemoteDelegate?.successfullyPushedDataToCloud()
398-
}
399-
completion(nil)
400-
return
401-
}
402392
var updatedParseVector = parseVector
403-
// Increment and merge Knowledge Vector
404-
updatedParseVector = incrementVectorClock(updatedParseVector)
393+
if shouldIncrementClock {
394+
// Increment Knowledge Vector
395+
updatedParseVector = incrementVectorClock(updatedParseVector)
396+
}
405397
updatedParseVector.merge(with: localClock)
398+
406399
guard let updatedClock = PCKClock.encodeVector(updatedParseVector, for: parseClock) else {
407-
await self.remoteStatus.updateClock(parseClock) // revert
408400
await self.remoteStatus.notSynchronzing()
409401
Logger.pushRevisions.error("Could not encode clock")
410402
completion(ParseCareKitError.couldntUnwrapClock)

0 commit comments

Comments
 (0)