Simplify change.
This commit is contained in:
parent
c21858c48c
commit
a05da2695b
@ -89,29 +89,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
guard self.parameterHandlerList.count > 0 else {
|
||||
completionHandler(nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Setup timeout.
|
||||
self.parametersWorkQueue.asyncAfter(deadline: .now() + .seconds(Int(timeout)), execute: timeoutWorkItem)
|
||||
|
||||
self.group.enter()
|
||||
|
||||
// Setup the parameter execution.
|
||||
for (index, parameterHandler) in self.parameterHandlerList.enumerated() {
|
||||
let parameterType = parameterHandler.clientParameterModel.type
|
||||
self.group.enter()
|
||||
parameterHandler.fetchClientParameters(requestParameters: requestParameters,
|
||||
timingOutIn: timeout) { (receivedParameter) in
|
||||
// Queue the results for merge.
|
||||
self.parametersWorkQueue.async {
|
||||
let previouslySatisfied = returnedList.allSatisfy { $0 != nil }
|
||||
if (returnedList[index] != nil) {
|
||||
MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, message: "Client parameter \(parameterType) has already executed. The completion handler should only be called once!", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: String(describing: ClientParameterHandler.self))!)
|
||||
}
|
||||
returnedList[index] = receivedParameter
|
||||
if (!previouslySatisfied && returnedList.allSatisfy { $0 != nil }) {
|
||||
} else {
|
||||
returnedList[index] = receivedParameter
|
||||
self.group.leave() // Leaving is only done after setup (barriered).
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user