singleflight: add per caller function
This PR is an alternative to the proposal in #9, inspired by @bcmills' comment.
The general idea is to add a second function argument to Do, which is guaranteed to be called by all goroutines waiting on a singleflight before the singleflighted call returns. It complements the existing function argument so that writing code that must be called in all cases becomes trivial.
Some refactoring to reduce code duplication could also be done, but I wanted to get some first working version out to kickstart a discussion.
Names are of course up for bikeshedding.
WDYT?
This PR (HEAD: 8fa636b7549ef62d9eb0218d8b59960510ed31f2) has been imported to Gerrit for code review.
Please visit https://go-review.googlesource.com/c/sync/+/444215 to see it.
Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info
Message from Bryan Mills:
Patch Set 1: Hold+1
(1 comment)
Please don’t reply on this GitHub thread. Visit golang.org/cl/444215. After addressing review feedback, remember to publish your drafts!
Message from Leo Antunes:
Patch Set 1:
(1 comment)
Please don’t reply on this GitHub thread. Visit golang.org/cl/444215. After addressing review feedback, remember to publish your drafts!
Moved to draft while proposal is active.
Message from Leo Antunes:
Patch Set 1:
(1 comment)
Please don’t reply on this GitHub thread. Visit golang.org/cl/444215. After addressing review feedback, remember to publish your drafts!