From 0f0436c7a8e14fd41c1b0a448e2b2d66f7813622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 4 Aug 2023 16:32:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=AB=98=E9=80=9F=E7=A1=AC?= =?UTF-8?q?=E7=9B=98=E4=B8=8B=E7=9A=84=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/caches/storage_file.go | 2 +- internal/utils/fs/status.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/caches/storage_file.go b/internal/caches/storage_file.go index a8e5acf..99b6f77 100644 --- a/internal/caches/storage_file.go +++ b/internal/caches/storage_file.go @@ -419,7 +419,7 @@ func (this *FileStorage) openWriter(key string, expiredAt int64, status int, hea maxMemorySize = maxSize } var memoryStorage = this.memoryStorage - if !isFlushing && !isPartial && memoryStorage != nil && ((bodySize > 0 && bodySize < maxMemorySize) || bodySize < 0) { + if !fsutils.DiskIsExtremelyFast() && !isFlushing && !isPartial && memoryStorage != nil && ((bodySize > 0 && bodySize < maxMemorySize) || bodySize < 0) { writer, err := memoryStorage.OpenWriter(key, expiredAt, status, headerSize, bodySize, maxMemorySize, false) if err == nil { return writer, nil diff --git a/internal/utils/fs/status.go b/internal/utils/fs/status.go index 5b769b3..58af938 100644 --- a/internal/utils/fs/status.go +++ b/internal/utils/fs/status.go @@ -66,6 +66,10 @@ func DiskIsFast() bool { return DiskSpeed == SpeedExtremelyFast || DiskSpeed == SpeedFast } +func DiskIsExtremelyFast() bool { + return DiskSpeed == SpeedExtremelyFast +} + var countWrites int32 = 0 func WriteReady() bool {