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 75c5c33694
commit 87071640a7
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. // Len returns the number of blocks in the cache c.
func (c *Cache) Len() int { func (c *Cache) Len() int {
c.mu.RLock() c.mu.RLock()
n := len(c.m) n := 0
for _, m := range c.m {
n += len(m)
}
c.mu.RUnlock() c.mu.RUnlock()
return n return n
} }