aboutsummaryrefslogtreecommitdiff
path: root/middleware/pkg/singleflight/singleflight.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/pkg/singleflight/singleflight.go')
-rw-r--r--middleware/pkg/singleflight/singleflight.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/middleware/pkg/singleflight/singleflight.go b/middleware/pkg/singleflight/singleflight.go
index ff2c2ee4f..365e3ef58 100644
--- a/middleware/pkg/singleflight/singleflight.go
+++ b/middleware/pkg/singleflight/singleflight.go
@@ -31,17 +31,17 @@ type call struct {
// units of work can be executed with duplicate suppression.
type Group struct {
mu sync.Mutex // protects m
- m map[string]*call // lazily initialized
+ m map[uint32]*call // lazily initialized
}
// Do executes and returns the results of the given function, making
// sure that only one execution is in-flight for a given key at a
// time. If a duplicate comes in, the duplicate caller waits for the
// original to complete and receives the same results.
-func (g *Group) Do(key string, fn func() (interface{}, error)) (interface{}, error) {
+func (g *Group) Do(key uint32, fn func() (interface{}, error)) (interface{}, error) {
g.mu.Lock()
if g.m == nil {
- g.m = make(map[string]*call)
+ g.m = make(map[uint32]*call)
}
if c, ok := g.m[key]; ok {
g.mu.Unlock()