Last active
July 25, 2017 18:04
-
-
Save lacyrhoades/c45c19ee103ee2d6c802cabcfa288956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func doTheThing() { | |
// First let's at least try to fix up each thing | |
// Has to be one-at-a-time | |
let waitGroup = DispatchGroup() | |
for missingID in self.missingIDs { | |
waitGroup.enter() | |
self.utility.tryToFixStuff(forItemID: missingID) { | |
waitGroup.leave() | |
} | |
waitGroup.wait() // this optionally takes a timeout param | |
} | |
// Go on doing the rest of the thing | |
// ... | |
} |
What are the odds that it fails? If it's a network thing there should be a time out.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm always worried like "What if
tryToFixStuff
never calls me back!?" – Not sure if that's rational.