mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-08 11:20:27 +08:00
智能调节清理缓存阈值
This commit is contained in:
@@ -1004,11 +1004,14 @@ func (this *FileStorage) purgeLoop() {
|
|||||||
if lfuFreePercent <= 0 {
|
if lfuFreePercent <= 0 {
|
||||||
lfuFreePercent = 5
|
lfuFreePercent = 5
|
||||||
|
|
||||||
// TB级别
|
// 2TB级别以上
|
||||||
if capacityBytes>>30 > 1000 {
|
if capacityBytes>>30 > 2000 {
|
||||||
|
lfuFreePercent = 100 /** GB **/ / float32(capacityBytes>>30) * 100 /** % **/
|
||||||
|
if lfuFreePercent > 3 {
|
||||||
lfuFreePercent = 3
|
lfuFreePercent = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var hasFullDisk = this.hasFullDisk()
|
var hasFullDisk = this.hasFullDisk()
|
||||||
if hasFullDisk {
|
if hasFullDisk {
|
||||||
@@ -1246,8 +1249,9 @@ func (this *FileStorage) hotLoop() {
|
|||||||
|
|
||||||
func (this *FileStorage) diskCapacityBytes() int64 {
|
func (this *FileStorage) diskCapacityBytes() int64 {
|
||||||
var c1 = this.policy.CapacityBytes()
|
var c1 = this.policy.CapacityBytes()
|
||||||
if SharedManager.MaxDiskCapacity != nil {
|
var nodeCapacity = SharedManager.MaxDiskCapacity // copy
|
||||||
var c2 = SharedManager.MaxDiskCapacity.Bytes()
|
if nodeCapacity != nil {
|
||||||
|
var c2 = nodeCapacity.Bytes()
|
||||||
if c2 > 0 {
|
if c2 > 0 {
|
||||||
return c2
|
return c2
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user