Http: when caching allow single inflight GET request only (#22959)

This commit is contained in:
andig 2025-08-15 08:55:22 +02:00 • committed by GitHub
parent 3c11886d35
commit ceb55dcae6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 0 deletions

21
plugin/http_limit.go Normal file
View file

@ -0,0 +1,21 @@
package plugin
import "sync"
var (
httpMu sync.Mutex
httpMutexes = map[string]*sync.Mutex{}
)
func muForKey(key string) *sync.Mutex {
httpMu.Lock()
defer httpMu.Unlock()
if mu, ok := httpMutexes[key]; ok {
return mu
}
mu := new(sync.Mutex)
httpMutexes[key] = mu
return mu
}