mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 23:20:25 +08:00
优化文件句柄缓存容量判断
This commit is contained in:
@@ -93,7 +93,7 @@ func (this *OpenFileCache) Put(filename string, file *OpenFile) {
|
|||||||
defer this.locker.Unlock()
|
defer this.locker.Unlock()
|
||||||
|
|
||||||
// 如果超过当前容量,则关闭最早的
|
// 如果超过当前容量,则关闭最早的
|
||||||
if this.count >= this.maxCount || this.usedSize >= this.capacitySize {
|
if this.count >= this.maxCount || this.usedSize+file.size >= this.capacitySize {
|
||||||
this.consumeHead()
|
this.consumeHead()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user