From 2b35971a66d2418fed2fc695c36f815530f378ec Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 30 Apr 2024 21:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E5=86=85=E5=AD=98=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=88=B0=E7=A3=81=E7=9B=98=E6=97=B6=E6=97=A0=E9=9C=80=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E5=86=99=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/caches/storage_file.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/caches/storage_file.go b/internal/caches/storage_file.go index 7fbc707..384ce9e 100644 --- a/internal/caches/storage_file.go +++ b/internal/caches/storage_file.go @@ -616,11 +616,13 @@ func (this *FileStorage) openWriter(key string, expiredAt int64, status int, hea if isNewCreated && existsFile { flags |= os.O_TRUNC } - if !fsutils.WriterLimiter.TryAck() { + if !isFlushing && !fsutils.WriterLimiter.TryAck() { return nil, ErrServerIsBusy } writer, err := os.OpenFile(tmpPath, flags, 0666) - fsutils.WriterLimiter.Release() + if !isFlushing { + fsutils.WriterLimiter.Release() + } if err != nil { if os.IsNotExist(err) { _ = os.MkdirAll(dir, 0777)