From c670272aa2dc6a9fdf8a0d6e0e22e051f58ee064 Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Tue, 24 Nov 2026 18:46:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=89=E9=99=90=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E5=AD=98=E5=82=A8=E6=A3=80=E6=B5=8B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=A0=E9=99=A4=E7=8A=B6=E6=80=81=E4=B8=80=E8=87=B4?= =?UTF-8?q?=20(#1382)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/SyncBusinessFilesToQiniu.php | 5 +++-- .../Feature/Console/SyncBusinessFilesToQiniuTest.php | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/SyncBusinessFilesToQiniu.php b/app/Console/Commands/SyncBusinessFilesToQiniu.php index f313b19f..a22f6224 100644 --- a/app/Console/Commands/SyncBusinessFilesToQiniu.php +++ b/app/Console/Commands/SyncBusinessFilesToQiniu.php @@ -13,9 +13,10 @@ use Throwable; class SyncBusinessFilesToQiniu extends Command { - private const PROBE_CLEANUP_MAX_ATTEMPTS = 10; + // Qiniu can briefly report a deleted object as present; keep the wait bounded. + private const PROBE_CLEANUP_MAX_ATTEMPTS = 20; - private const PROBE_CLEANUP_RETRY_DELAY_MICROSECONDS = 500_000; + private const PROBE_CLEANUP_RETRY_DELAY_MICROSECONDS = 1_000_000; protected $signature = 'storage:business-files:sync {--require-qiniu : Fail unless the private Qiniu backend is enabled} diff --git a/tests/Feature/Console/SyncBusinessFilesToQiniuTest.php b/tests/Feature/Console/SyncBusinessFilesToQiniuTest.php index 03e6c304..caaa43a7 100644 --- a/tests/Feature/Console/SyncBusinessFilesToQiniuTest.php +++ b/tests/Feature/Console/SyncBusinessFilesToQiniuTest.php @@ -68,7 +68,7 @@ class SyncBusinessFilesToQiniuTest extends TestCase public function test_it_retries_probe_cleanup_until_qiniu_reports_the_object_missing(): void { $this->assertSame( - [500_000, 500_000], + [1_000_000, 1_000_000], $this->invokeProbeCleanup([true, true, false]) ); } @@ -78,7 +78,15 @@ class SyncBusinessFilesToQiniuTest extends TestCase $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Business storage probe cleanup failed.'); - $this->invokeProbeCleanup(array_fill(0, 10, true)); + $this->invokeProbeCleanup(array_fill(0, 20, true)); + } + + public function test_probe_cleanup_accepts_delayed_visibility_after_the_previous_wait_window(): void + { + $this->assertSame( + array_fill(0, 12, 1_000_000), + $this->invokeProbeCleanup([...array_fill(0, 12, true), false]) + ); } private function invokeProbeCleanup(array $existsResults): array