|
|
|
|
|
by marcus_holmes
4221 days ago
|
|
This is terrible. Each result blocks in the first example (e.g. if the first url in the array returns in 3s and the second url returns in 3ms - the routine will wait 3s then deal with both instead of dealing with the 3ms result immediately it returns).
The second example blocks until all the results are in. This might be want you want, but if so then you might as well run them serially. The advantage of concurrency is that it can deal with the results as they come in. The correct way to do this is to return results on a chan of (error, response) regardless of how much you "don't like it" for unspecified reasons. |
|