mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
bf14d0cb26
commit
564bae06f6
1 changed files with 8 additions and 1 deletions
9
cache/dynacache/dynacache.go
vendored
9
cache/dynacache/dynacache.go
vendored
|
@ -119,7 +119,8 @@ func (o OptionsPartition) CalculateMaxSize(maxSizePerPartition int) int {
|
||||||
|
|
||||||
// A dynamic partitioned cache.
|
// A dynamic partitioned cache.
|
||||||
type Cache struct {
|
type Cache struct {
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
|
resizeMu sync.Mutex
|
||||||
|
|
||||||
partitions map[string]PartitionManager
|
partitions map[string]PartitionManager
|
||||||
|
|
||||||
|
@ -231,6 +232,12 @@ func (c *Cache) Stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) adjustCurrentMaxSize() {
|
func (c *Cache) adjustCurrentMaxSize() {
|
||||||
|
if !c.resizeMu.TryLock() {
|
||||||
|
// Prevent multiple concurrent resizes.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer c.resizeMu.Unlock()
|
||||||
|
|
||||||
c.mu.RLock()
|
c.mu.RLock()
|
||||||
defer c.mu.RUnlock()
|
defer c.mu.RUnlock()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue