From 43776d749785c9380f5956d1a0290e916c9e980b Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 9 Jan 2025 20:28:01 +0800 Subject: [PATCH 1/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt | 4 ++-- .../atom/service/impl/AtomHandleBuildResultServiceImpl.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt index 4ebc8e16302..f9f16d0761e 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt @@ -39,6 +39,7 @@ import com.tencent.devops.model.store.tables.TLabel import com.tencent.devops.model.store.tables.TStoreMember import com.tencent.devops.model.store.tables.TStoreStatisticsTotal import com.tencent.devops.model.store.tables.records.TAtomRecord +import com.tencent.devops.store.common.utils.VersionUtils import com.tencent.devops.store.pojo.atom.ApproveReq import com.tencent.devops.store.pojo.atom.MarketAtomCreateRequest import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest @@ -47,7 +48,6 @@ import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum import com.tencent.devops.store.pojo.atom.enums.AtomTypeEnum import com.tencent.devops.store.pojo.atom.enums.MarketAtomSortTypeEnum import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum -import com.tencent.devops.store.common.utils.VersionUtils import java.math.BigDecimal import java.time.LocalDateTime import org.jooq.Condition @@ -739,7 +739,7 @@ class MarketAtomDao : AtomBaseDao() { LATEST_TEST_FLAG, DSL.case_().`when`(ID.eq(atomId), true).otherwise(false) ) - .set(MODIFIER, userId) + .set(MODIFIER, DSL.case_().`when`(ID.eq(atomId), userId)) .where(ATOM_CODE.eq(atomCode)) .execute() } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt index 4e6f387247c..8c6345c0922 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt @@ -98,7 +98,7 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( redisLock.lock() marketAtomDao.setupAtomLatestTestFlag( dslContext = dslContext, - userId = storeBuildResultRequest.userId, + userId = atomRecord.modifier, atomCode = atomCode, atomId = atomId ) From 044af155311757926d55a93f7a02135183361aaf Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 09:48:19 +0800 Subject: [PATCH 2/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/atom/dao/MarketAtomDao.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt index f9f16d0761e..e3977dd4a7f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt @@ -732,15 +732,19 @@ class MarketAtomDao : AtomBaseDao() { } } - fun setupAtomLatestTestFlag(dslContext: DSLContext, userId: String, atomCode: String, atomId: String) { + fun setupAtomLatestTestFlag( + dslContext: DSLContext, + userId: String, + atomCode: String, + atomId: String + ) { with(TAtom.T_ATOM) { dslContext.update(this) .set( LATEST_TEST_FLAG, DSL.case_().`when`(ID.eq(atomId), true).otherwise(false) ) - .set(MODIFIER, DSL.case_().`when`(ID.eq(atomId), userId)) - .where(ATOM_CODE.eq(atomCode)) + .set(MODIFIER, DSL.case_().`when`(ID.eq(atomId), userId).otherwise(MODIFIER)) .execute() } } From 8db251e4a0158547893eac41860969a92300518c Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 10:25:32 +0800 Subject: [PATCH 3/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/atom/dao/MarketAtomDao.kt | 26 +++++++++++++------ .../impl/AtomHandleBuildResultServiceImpl.kt | 10 ++++--- .../service/impl/AtomReleaseServiceImpl.kt | 10 ++++--- .../impl/SampleAtomReleaseServiceImpl.kt | 12 ++++++--- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt index e3977dd4a7f..76a1961f00f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/dao/MarketAtomDao.kt @@ -732,19 +732,29 @@ class MarketAtomDao : AtomBaseDao() { } } - fun setupAtomLatestTestFlag( + fun setupAtomLatestTestFlagById( dslContext: DSLContext, userId: String, - atomCode: String, - atomId: String + atomId: String, + latestFlag: Boolean ) { with(TAtom.T_ATOM) { dslContext.update(this) - .set( - LATEST_TEST_FLAG, - DSL.case_().`when`(ID.eq(atomId), true).otherwise(false) - ) - .set(MODIFIER, DSL.case_().`when`(ID.eq(atomId), userId).otherwise(MODIFIER)) + .set(LATEST_TEST_FLAG, latestFlag) + .set(MODIFIER, userId) + .where(ID.eq(atomId)) + .execute() + } + } + + fun resetAtomLatestTestFlagByCode( + dslContext: DSLContext, + atomCode: String + ) { + with(TAtom.T_ATOM) { + dslContext.update(this) + .set(LATEST_TEST_FLAG, false) + .where(ATOM_CODE.eq(atomCode)) .execute() } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt index 8c6345c0922..b26d4b7acb1 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt @@ -96,11 +96,15 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( 60L ).use { redisLock -> redisLock.lock() - marketAtomDao.setupAtomLatestTestFlag( + marketAtomDao.resetAtomLatestTestFlagByCode( dslContext = dslContext, + atomCode = atomCode + ) + marketAtomDao.setupAtomLatestTestFlagById( + dslContext = dslContext, + atomId = atomId, userId = atomRecord.modifier, - atomCode = atomCode, - atomId = atomId + latestFlag = true ) } // 插件errorCodes.json文件数据入库 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index f001714dd31..49b52640489 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1458,11 +1458,15 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ redisLock.lock() if (marketAtomDao.isAtomLatestTestVersion(dslContext, atomId) > 0) { val latestTestVersionId = marketAtomDao.queryAtomLatestTestVersionId(dslContext, atomCode, atomId) - marketAtomDao.setupAtomLatestTestFlag( + marketAtomDao.resetAtomLatestTestFlagByCode( dslContext = dslContext, + atomCode = atomCode + ) + marketAtomDao.setupAtomLatestTestFlagById( + dslContext = dslContext, + atomId = latestTestVersionId ?: "", userId = userId, - atomCode = atomCode, - atomId = latestTestVersionId ?: "" + latestFlag = true ) } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt index e1d7949f49d..7d4f0450caa 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt @@ -51,8 +51,8 @@ import com.tencent.devops.store.pojo.atom.MarketAtomCreateRequest import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum import com.tencent.devops.store.pojo.common.STORE_LATEST_TEST_FLAG_KEY_PREFIX -import com.tencent.devops.store.pojo.common.publication.ReleaseProcessItem import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum +import com.tencent.devops.store.pojo.common.publication.ReleaseProcessItem import org.jooq.DSLContext import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @@ -100,11 +100,15 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic 60L ).use { redisLock -> redisLock.lock() - marketAtomDao.setupAtomLatestTestFlag( + marketAtomDao.resetAtomLatestTestFlagByCode( + dslContext = dslContext, + atomCode = record.atomCode + ) + marketAtomDao.setupAtomLatestTestFlagById( dslContext = dslContext, + atomId = atomId, userId = userId, - atomCode = record.atomCode, - atomId = atomId + latestFlag = true ) } } From 51762170d5e517c13d30d880f0bbd6faecd29720 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 10:53:34 +0800 Subject: [PATCH 4/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt | 2 +- .../store/image/service/impl/ImageHandleBuildResultService.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt index b26d4b7acb1..0f651efa385 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt @@ -85,7 +85,7 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( marketAtomService.setAtomBuildStatusByAtomCode( atomCode = atomCode, version = version, - userId = storeBuildResultRequest.userId, + userId = atomRecord.modifier, atomStatus = atomStatus, msg = null ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt index c38e3c5c58a..83f356e7a5d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt @@ -73,7 +73,7 @@ class ImageHandleBuildResultService @Autowired constructor( } marketImageService.setImageBuildStatusByImageId( imageId = imageId, - userId = storeBuildResultRequest.userId, + userId = imageRecord.modifier, imageStatus = imageStatus, msg = null ) From 1efcd5fc5275341584e85e700685742fa0465a1a Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 10:56:11 +0800 Subject: [PATCH 5/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/image/service/impl/ImageHandleBuildResultService.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt index 83f356e7a5d..3b098b03d0e 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/image/service/impl/ImageHandleBuildResultService.kt @@ -30,11 +30,11 @@ import com.tencent.devops.common.api.constant.CommonMessageCode import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.pipeline.enums.BuildStatus import com.tencent.devops.common.web.utils.I18nUtil +import com.tencent.devops.store.common.service.AbstractStoreHandleBuildResultService import com.tencent.devops.store.image.dao.ImageDao +import com.tencent.devops.store.image.service.MarketImageService import com.tencent.devops.store.pojo.common.publication.StoreBuildResultRequest import com.tencent.devops.store.pojo.image.enums.ImageStatusEnum -import com.tencent.devops.store.common.service.AbstractStoreHandleBuildResultService -import com.tencent.devops.store.image.service.MarketImageService import org.jooq.DSLContext import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired From 5f4aa2de67f19a9d101971a1ebd234c012026a52 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 11:21:40 +0800 Subject: [PATCH 6/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AtomReleaseServiceImpl.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index 49b52640489..0d875c81066 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1458,16 +1458,18 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ redisLock.lock() if (marketAtomDao.isAtomLatestTestVersion(dslContext, atomId) > 0) { val latestTestVersionId = marketAtomDao.queryAtomLatestTestVersionId(dslContext, atomCode, atomId) - marketAtomDao.resetAtomLatestTestFlagByCode( - dslContext = dslContext, - atomCode = atomCode - ) - marketAtomDao.setupAtomLatestTestFlagById( - dslContext = dslContext, - atomId = latestTestVersionId ?: "", - userId = userId, - latestFlag = true - ) + latestTestVersionId?.let { + marketAtomDao.resetAtomLatestTestFlagByCode( + dslContext = dslContext, + atomCode = atomCode + ) + marketAtomDao.setupAtomLatestTestFlagById( + dslContext = dslContext, + atomId = latestTestVersionId, + userId = userId, + latestFlag = true + ) + } } } } From 1978177b8d3cd5d2d9294a4858a6be5fda27e5e6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 11:43:08 +0800 Subject: [PATCH 7/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/atom/service/AtomReleaseService.kt | 2 ++ .../impl/AtomHandleBuildResultServiceImpl.kt | 12 ++------- .../service/impl/AtomReleaseServiceImpl.kt | 27 +++++++++++++------ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/AtomReleaseService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/AtomReleaseService.kt index fef5be94c25..8da7d89435f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/AtomReleaseService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/AtomReleaseService.kt @@ -108,4 +108,6 @@ interface AtomReleaseService { * 结束分支版本测试 */ fun endBranchVersionTest(userId: String, atomCode: String, branch: String): Result + + fun updateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt index 0f651efa385..03a853f4068 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomHandleBuildResultServiceImpl.kt @@ -90,22 +90,14 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( msg = null ) if (atomStatus == AtomStatusEnum.TESTING) { + RedisLock( redisOperation, "$STORE_LATEST_TEST_FLAG_KEY_PREFIX:$atomCode", 60L ).use { redisLock -> redisLock.lock() - marketAtomDao.resetAtomLatestTestFlagByCode( - dslContext = dslContext, - atomCode = atomCode - ) - marketAtomDao.setupAtomLatestTestFlagById( - dslContext = dslContext, - atomId = atomId, - userId = atomRecord.modifier, - latestFlag = true - ) + atomReleaseService.updateAtomLatestTestFlag(atomRecord.modifier, atomCode, atomId) } // 插件errorCodes.json文件数据入库 atomReleaseService.syncAtomErrorCodeConfig( diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index 0d875c81066..ea7d9d00e8d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1459,18 +1459,29 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ if (marketAtomDao.isAtomLatestTestVersion(dslContext, atomId) > 0) { val latestTestVersionId = marketAtomDao.queryAtomLatestTestVersionId(dslContext, atomCode, atomId) latestTestVersionId?.let { - marketAtomDao.resetAtomLatestTestFlagByCode( - dslContext = dslContext, - atomCode = atomCode - ) - marketAtomDao.setupAtomLatestTestFlagById( - dslContext = dslContext, - atomId = latestTestVersionId, + updateAtomLatestTestFlag( userId = userId, - latestFlag = true + atomCode = atomCode, + atomId = it ) } } } } + + override fun updateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) { + dslContext.transaction { configuration -> + val transactionContext = DSL.using(configuration) + marketAtomDao.resetAtomLatestTestFlagByCode( + dslContext = transactionContext, + atomCode = atomCode + ) + marketAtomDao.setupAtomLatestTestFlagById( + dslContext = transactionContext, + atomId = atomId, + userId = userId, + latestFlag = true + ) + } + } } From 67b54336eb33e0dc007554420d8c49e2b469030d Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 11:46:31 +0800 Subject: [PATCH 8/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/atom/service/impl/AtomReleaseServiceImpl.kt | 2 +- .../atom/service/impl/SampleAtomReleaseServiceImpl.kt | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index ea7d9d00e8d..56bbbca1b58 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1449,7 +1449,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ return Result(atomId) } - fun checkUpdateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) { + private fun checkUpdateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) { RedisLock( redisOperation, "$STORE_LATEST_TEST_FLAG_KEY_PREFIX:$atomCode", diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt index 7d4f0450caa..e696d223c42 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/SampleAtomReleaseServiceImpl.kt @@ -100,16 +100,7 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic 60L ).use { redisLock -> redisLock.lock() - marketAtomDao.resetAtomLatestTestFlagByCode( - dslContext = dslContext, - atomCode = record.atomCode - ) - marketAtomDao.setupAtomLatestTestFlagById( - dslContext = dslContext, - atomId = atomId, - userId = userId, - latestFlag = true - ) + updateAtomLatestTestFlag(userId, record.atomCode, atomId) } } } From 523b44c6158003ca02503b04a8c6cdaf29d586b1 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 10 Jan 2025 11:55:04 +0800 Subject: [PATCH 9/9] =?UTF-8?q?bug:=E7=BB=84=E4=BB=B6latestFlag=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=97=B6=E7=BB=84=E4=BB=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=88=E6=9C=AC=E4=BF=AE=E6=94=B9=E8=80=85=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E4=B8=BA=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=BA=20#11400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/atom/service/impl/AtomReleaseServiceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt index 56bbbca1b58..ea7d9d00e8d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/AtomReleaseServiceImpl.kt @@ -1449,7 +1449,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ return Result(atomId) } - private fun checkUpdateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) { + fun checkUpdateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) { RedisLock( redisOperation, "$STORE_LATEST_TEST_FLAG_KEY_PREFIX:$atomCode",