Wait until the sync has stopped before marking the task as complete. (#3564)

This commit is contained in:
Doug
2024-11-28 17:30:07 +00:00
committed by GitHub
parent d48fb64468
commit 4869dcfe97
4 changed files with 54 additions and 13 deletions
@@ -2346,6 +2346,41 @@ class ClientProxyMock: ClientProxyProtocol {
stopSyncCallsCount += 1
stopSyncClosure?()
}
//MARK: - stopSync
var stopSyncCompletionUnderlyingCallsCount = 0
var stopSyncCompletionCallsCount: Int {
get {
if Thread.isMainThread {
return stopSyncCompletionUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = stopSyncCompletionUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
stopSyncCompletionUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
stopSyncCompletionUnderlyingCallsCount = newValue
}
}
}
}
var stopSyncCompletionCalled: Bool {
return stopSyncCompletionCallsCount > 0
}
var stopSyncCompletionClosure: (((() -> Void)?) -> Void)?
func stopSync(completion: (() -> Void)?) {
stopSyncCompletionCallsCount += 1
stopSyncCompletionClosure?(completion)
}
//MARK: - accountURL
var accountURLActionUnderlyingCallsCount = 0