stabilize NSProgress when lightweight migration falls back to InferredMappingModel

This commit is contained in:
John Estropia
2018-08-09 18:18:21 +09:00
parent 30685d4355
commit 808e8ff97a
2 changed files with 6 additions and 3 deletions

View File

@@ -708,9 +708,9 @@ public extension DataStack {
var fakeProgress: Float = 0
var recursiveCheck: () -> Void = {}
recursiveCheck = {
recursiveCheck = { [weak timerQueue] in
guard fakeProgress < 1 else {
guard let timerQueue = timerQueue, fakeProgress < 1 else {
return
}

View File

@@ -42,7 +42,10 @@ internal final class MigrationManager: NSMigrationManager, ProgressReporting {
return
}
let progress = self.progress
progress.completedUnitCount = Int64(Float(progress.totalUnitCount) * self.migrationProgress)
progress.completedUnitCount = max(
progress.completedUnitCount,
Int64(Float(progress.totalUnitCount) * self.migrationProgress)
)
}