mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-27 10:10:25 +08:00
修复存储空间统计可能为负值的问题
This commit is contained in:
@@ -177,10 +177,15 @@ func (this *Manager) TotalDiskSize() int64 {
|
|||||||
this.locker.RLock()
|
this.locker.RLock()
|
||||||
defer this.locker.RUnlock()
|
defer this.locker.RUnlock()
|
||||||
|
|
||||||
total := int64(0)
|
var total = int64(0)
|
||||||
for _, storage := range this.storageMap {
|
for _, storage := range this.storageMap {
|
||||||
total += storage.TotalDiskSize()
|
total += storage.TotalDiskSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if total < 0 {
|
||||||
|
total = 0
|
||||||
|
}
|
||||||
|
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user