Compare commits

...

1 commit

Author SHA1 Message Date
Karl Seguin
d7846ec7e0 grab lookup len under read lock 2020-08-13 10:41:28 +08:00

View file

@ -56,7 +56,12 @@ func (b *bucket) delete(key string) *Item {
// write lock)
func (b *bucket) deleteFunc(matches func(key string, item interface{}) bool, deletables chan *Item) int {
lookup := b.lookup
items := make([]*Item, 0, len(lookup)/10)
b.RLock()
l := len(lookup)
b.RUnlock()
items := make([]*Item, 0, l/10)
b.RLock()
for key, item := range lookup {