Thanks for bringing singleflight to my attention. However, if I'm not wrong, it doesn't seem to fully solve the problem.
If after uploading, I call singleflight.Do, and pass the file name and the compression function, when users requests a file, should I call singleflight.Do and pass the requested file name and the compression function again? Doesn't that mean I can never forget a key otherwise the file may get compressed multiple times? On Tuesday, July 25, 2017 at 2:47:44 PM UTC+8, Tamás Gulácsi wrote: > > See http://godoc.org/go4.org/syncutil/singleflight for another solution. > If you key by file name/id, and the function compresses when needed and > then returns the (de)compressed file, it'll solve your problem. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.