Skip to content

Commit

Permalink
bug: 修复预加载计划超时失败后未删除记录 TencentBlueKing#2242
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlkl authored Jun 12, 2024
1 parent 6c6d9c4 commit 980400b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class ArtifactPreloadPlanServiceImpl(
size = node.size,
strategy = strategy
)
logger.info("generate preload plan for sha256[${node.sha256}]")
generator.generate(param)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ class DefaultPreloadPlanExecutor(

fun load(plan: ArtifactPreloadPlan, credentials: StorageCredentials, listener: PreloadListener?) {
try {
logger.info("preload start, ${plan.artifactInfo()}")
listener?.onPreloadStart(plan)
if (System.currentTimeMillis() - plan.executeTime > preloadProperties.planTimeout.toMillis()) {
throw RuntimeException("plan timeout[${plan.executeTime}], ${plan.artifactInfo()}")
}
logger.info("preload start, ${plan.artifactInfo()}")
listener?.onPreloadStart(plan)
val cacheFile = Paths.get(credentials.cache.path, fileLocator.locate(plan.sha256), plan.sha256)
val cacheFileLock = Paths.get(credentials.cache.path, StringPool.TEMP, "${plan.sha256}.locked")
val throughput = if (cacheFile.existReal()) {
Expand Down

0 comments on commit 980400b

Please sign in to comment.