Closed bgentry closed 11 years ago
The approach looks basically sane to me. A couple of observations:
Another way to approach this is to write the serial version first. How would you write the code with no concurrency. Once you're basically happy with it that way, then add concurrency.
Another thing you can do if you need to collect one or more errors is to pass in a buffered error chan, so you can do up to N unconditional sends. After calling Wait, you can use len on the channel to see how many errors happened.
This may or may not be better. Sometimes I have intuition about which things to use, sometimes I just try a few ways and see which one does the best job of "say what you mean", or looks nicest, or expresses the intent most clearly.
@kr Let me know if you have any final feedback on this one. I'd like to get it merged in tomorrow.
Sure, I'll look at it today. Sorry, I didn't get a notification when you pushed up the latest version of this PR.
Looks good to me.
:v:
This is definitely not ready, and IMO the code is terrible & overcomplicated so far. But it does at least work.
Hoping to iterate on this a bit, so don't worry too much about reviewing it yet. I wouldn't be surprised if I can cut the LoC and complexity significantly.
Mostly I've just been struggling to find the right concurrency patterns, and as-is it's a bad mix of a few different things. Essentially it just needs to:
dchan
currently)If you have suggestions on the concurrency patterns, I'm all ears! The code for after step 3 doesn't feel right as it's currently built.
I've tried to make the process idempotent. If a build fails at a particular step, that particular build shouldn't complete, but the others still may. Running the build process again should just figure out what's left to be done and do that.