From a2bcf2c82cb9d7278decb6f3620f94fa8666a885 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 20 Aug 2023 11:02:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=A1=AC=E7=9B=98=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=B7=B2=E6=BB=A1=E6=97=B6=E5=90=8C=E6=97=B6=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E7=BC=93=E5=AD=98=E7=AD=96=E7=95=A5=E4=B8=AD=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=9A=84=E5=AE=B9=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/caches/storage_file.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/caches/storage_file.go b/internal/caches/storage_file.go index 0e26fce..0b27159 100644 --- a/internal/caches/storage_file.go +++ b/internal/caches/storage_file.go @@ -1418,7 +1418,7 @@ func (this *FileStorage) initOpenFileCache() { } func (this *FileStorage) runMemoryStorageSafety(f func(memoryStorage *MemoryStorage)) { - var memoryStorage = this.memoryStorage + var memoryStorage = this.memoryStorage // copy if memoryStorage != nil { f(memoryStorage) } @@ -1437,6 +1437,15 @@ func (this *FileStorage) checkDiskSpace() { stat, err := fsutils.StatDevice(options.Dir) if err == nil { this.mainDiskIsFull = stat.FreeSize() < minFreeSize + + // check capacity (only on main directory) + var policy = this.policy // copy + if !this.mainDiskIsFull && policy != nil { + var capacityBytes = policy.CapacityBytes() // copy + if capacityBytes > 0 && stat.UsedSize() >= uint64(capacityBytes) { + this.mainDiskIsFull = true + } + } } } var subDirs = this.subDirs // copy slice