<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Singleflight on Cesar Gimenes</title><link>https://crg.eti.br/en/tags/singleflight/</link><description>Recent content in Singleflight on Cesar Gimenes</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>crg@crg.eti.br (Cesar Gimenes)</managingEditor><webMaster>crg@crg.eti.br (Cesar Gimenes)</webMaster><lastBuildDate>Sat, 13 Jun 2026 09:57:41 -0300</lastBuildDate><atom:link href="https://crg.eti.br/en/tags/singleflight/index.xml" rel="self" type="application/rss+xml"/><item><title>singleflight in Go</title><link>https://crg.eti.br/en/post/singleflight/</link><pubDate>Sat, 13 Jun 2026 09:57:41 -0300</pubDate><author>crg@crg.eti.br (Cesar Gimenes)</author><guid>https://crg.eti.br/en/post/singleflight/</guid><description>&lt;p>You have an expensive, heavy function. During a traffic spike, six requests arrive at the same time asking for exactly the same thing. With no precautions, you run that function six times to get six identical results.&lt;/p>
&lt;p>&lt;strong>singleflight&lt;/strong> is a pattern that collapses those calls. The first call for a key does the real work. Every other call that arrives &lt;em>while it&amp;rsquo;s in progress&lt;/em> waits and gets the same result. One execution, many consumers.&lt;/p></description></item></channel></rss>