From a27358031be712ef8cbaa86448b78d5f7b438c95 Mon Sep 17 00:00:00 2001 From: kunlongli <16629885+cnlkl@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:31:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E5=AD=98=E5=82=A8=E6=97=B6=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=BD=92=E6=A1=A3=E6=96=87=E4=BB=B6=E8=AF=AF?= =?UTF-8?q?=E5=88=A0=E9=97=AE=E9=A2=98=20#2742?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bkrepo/job/batch/task/clean/FileReferenceCleanupJob.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/batch/task/clean/FileReferenceCleanupJob.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/batch/task/clean/FileReferenceCleanupJob.kt index a451becd6e..aedf778dba 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/batch/task/clean/FileReferenceCleanupJob.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/batch/task/clean/FileReferenceCleanupJob.kt @@ -149,8 +149,13 @@ class FileReferenceCleanupJob( logger.info("Mock delete $sha256 on $credentialsKey.") return } - var successToDeleted = cleanupRelatedResources(sha256, credentialsKey) + + // 删除文件 + var successToDeleted = false val existsRefOfMappingStorage = existsRefOfMappingStorage(row, collectionName) + if (!existsRefOfMappingStorage) { + successToDeleted = cleanupRelatedResources(sha256, credentialsKey) + } if (!existsRefOfMappingStorage && storageService.exist(sha256, storageCredentials)) { storageService.delete(sha256, storageCredentials) successToDeleted = true