https://www.codingexplorations.com/blog/understanding-singleflight-in-golang-a-solution-for-eliminating-redundant-work
无意间看到 singleflight 这个包感觉挺有意思的,就试着在摸鱼项目里玩了下。功能糊起来不难,但写单元测试的时候才发现,我对并发根本就是一窍不通
让 AI 连教带拽,总算是把单测写好了。感觉等明天我就看不懂这段代码了:
https://github.com/IceCodeNew/dummy-https-proxy-sub/commit/84bc47d0f45866d3d8f3a3b73dd131655fc5e930
无意间看到 singleflight 这个包感觉挺有意思的,就试着在摸鱼项目里玩了下。功能糊起来不难,但写单元测试的时候才发现,我对并发根本就是一窍不通
让 AI 连教带拽,总算是把单测写好了。感觉等明天我就看不懂这段代码了:
https://github.com/IceCodeNew/dummy-https-proxy-sub/commit/84bc47d0f45866d3d8f3a3b73dd131655fc5e930