Skip to content

Commit

Permalink
fix: 增加预加载策略生成相关debug日志 #2658
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlkl committed Nov 22, 2024
1 parent 505a791 commit b29aabf
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class ArtifactPreloadPlanServiceImpl(
// 限制查询出来的最大node数量,避免预加载计划创建时间过久
logger.warn("nodes of sha256[$sha256] exceed max page size[${properties.maxNodes}]")
return
} else if (nodes.isEmpty()) {
logger.debug("nodes of sha256[$sha256] found")
return
}
// node属于同一项目仓库的概率较大,缓存避免频繁查询策略
val strategyCache = HashMap<String, List<ArtifactPreloadStrategy>>()
Expand All @@ -130,11 +133,15 @@ class ArtifactPreloadPlanServiceImpl(
for (node in nodes) {
val repo = repositoryCache.get(buildRepoId(node.projectId, node.repoName))
if (repo.storageCredentialsKey != credentialsKey) {
logger.debug("credentialsKey of repo[${repo.name}] not match dst credentialsKey[${credentialsKey}]")
continue
}
val strategies = strategyCache.getOrPut(buildRepoId(node.projectId, node.repoName)) {
strategyService.list(node.projectId, node.repoName)
}
if (strategies.isEmpty()) {
logger.debug("preload strategy of repo[${repo.projectId}/${repo.name}] is empty")
}
strategies.forEach { strategy ->
matchAndGeneratePlan(strategy, node, repo.storageCredentialsKey)?.let { plans.add(it) }
}
Expand Down

0 comments on commit b29aabf

Please sign in to comment.