HackerTrans
TopNewTrendsCommentsPastAskShowJobs

gkalin59

no profile record

comments

gkalin59
·vor 2 Monaten·discuss
The problem with singleflight is that when a goroutine that grabs it first happens to be a slow request, it slows down entire group. What's worse is if it returns error, rest of group share the fate. That sometimes shows in bursts of cancellations on one of goroutines timing out.

Better would be if it was semaphoreflight e.g. allow up to N concurrent requests to proceed to amortize this.

Another issue is there's per group lock that can generate meaningful contention just to check the result.