lib/blockcache: return proper number of entries from the cache

This has been broken in 0d7374ad2f
This commit is contained in:
Aliaksandr Valialkin 2022-02-07 19:28:36 +02:00
parent 21bd204e81
commit cde4664f0d
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -199,7 +199,10 @@ end:
// Len returns the number of blocks in the cache c.
func (c *Cache) Len() int {
c.mu.RLock()
n := len(c.m)
n := 0
for _, m := range c.m {
n += len(m)
}
c.mu.RUnlock()
return n
}