SingleFlight
Deduplicates concurrent work by key: callers with equal keys share one in-flight execution.
The first caller for a key runs its block; every caller that arrives while that execution is in flight waits for it and receives the same result or failure. When the execution finishes, the key is released and the next caller starts a fresh one, so completed keys hold no memory.
Thread safety: this class is safe for concurrent use from multiple coroutines and threads; all internal state is guarded by a Mutex.
Functions
Link copied to clipboard
Returns the number of keys with an execution currently in flight.
Link copied to clipboard
Returns true while an execution for key is in flight.