diff --git a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/center/CommitEdgeCenterFsServiceImpl.kt b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/center/CommitEdgeCenterFsServiceImpl.kt index 4785ee672b..287933512b 100644 --- a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/center/CommitEdgeCenterFsServiceImpl.kt +++ b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/center/CommitEdgeCenterFsServiceImpl.kt @@ -47,7 +47,7 @@ class CommitEdgeCenterFsServiceImpl( ) { override fun buildTNode(request: NodeCreateRequest): TNode { val tNode = super.buildTNode(request) - tNode.clusterNames = setOf(SecurityUtils.getClusterName() ?: clusterProperties.self.name!!) + tNode.clusterNames = SecurityUtils.getClusterName()?.let { setOf(it) } return tNode } } diff --git a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/edge/EdgeFsServiceImpl.kt b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/edge/EdgeFsServiceImpl.kt index 6455ce9f35..1dc61cb480 100644 --- a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/edge/EdgeFsServiceImpl.kt +++ b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/service/fs/impl/edge/EdgeFsServiceImpl.kt @@ -27,8 +27,9 @@ package com.tencent.bkrepo.repository.service.fs.impl.edge -import com.tencent.bkrepo.common.service.cluster.properties.ClusterProperties +import com.tencent.bkrepo.common.artifact.util.ClusterUtils.reportMetadataToCenter import com.tencent.bkrepo.common.service.cluster.condition.CommitEdgeEdgeCondition +import com.tencent.bkrepo.common.service.cluster.properties.ClusterProperties import com.tencent.bkrepo.common.service.feign.FeignClientFactory import com.tencent.bkrepo.repository.api.cluster.ClusterFsNodeClient import com.tencent.bkrepo.repository.dao.NodeDao @@ -53,18 +54,28 @@ class EdgeFsServiceImpl( by lazy { FeignClientFactory.create(clusterProperties.center, "repository", clusterProperties.self.name) } override fun createNode(createRequest: NodeCreateRequest): NodeDetail { - centerNodeClient.createNode(createRequest) - return super.createNode(createRequest) + with(createRequest) { + if (reportMetadataToCenter(projectId, repoName)) { + centerNodeClient.createNode(this) + } + return super.createNode(this) + } } override fun setLength(setLengthRequest: NodeSetLengthRequest) { - centerNodeClient.setLength(setLengthRequest) - super.setLength(setLengthRequest) + with(setLengthRequest) { + if (reportMetadataToCenter(projectId, repoName)) { + centerNodeClient.setLength(this) + } + super.setLength(this) + } } override fun buildTNode(request: NodeCreateRequest): TNode { val tNode = super.buildTNode(request) - tNode.clusterNames = setOf(clusterProperties.self.name!!) + if (reportMetadataToCenter(request.projectId, request.repoName)) { + tNode.clusterNames = setOf(clusterProperties.self.name!!) + } return tNode } }