Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 views
in Technique[技术] by (71.8m points)

go - Race-condition with errgroup?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The docs for errgroup indicate that "the first call to return a non-nil error cancels the group; its error will be returned by Wait."

Since these are running concurrently, it's not predictable in which order the failure will occur. Sometimes it occurs right away, other times only after other goroutines have successfully run. On average, it sounds like 3-5 are running before the error. As soon as that error happens, the group is canceled and any goroutines that haven't yet been started won't run at all.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...