logoalt Hacker News

Understanding Singleflight in Go

43 pointsby ghostbitlast Saturday at 9:57 PM6 commentsview on HN

Comments

jzelinskieyesterday at 9:10 PM

"Understanding _using_ singleflight in Go" would be a better title. This generated article doesn't give the reader a real understanding of the implementation and its various tradeoffs that you might care about depending on your workload (e.g. should the first execution to reach a key spawn a goroutine or is that allocation too much)

theowaway213456yesterday at 9:55 PM

This implementation is better than stdlib's implementation in my opinion, since it respects context:

https://github.com/janos/singleflight

mholtyesterday at 10:47 PM

First I've heard of this. Lazyweb, why would I use this over sync.Once?

show 3 replies