Skip to content

Commit

Permalink
feat: 目录统计调整 TencentBlueKing#2313
Browse files Browse the repository at this point in the history
  • Loading branch information
zacYL committed Jul 5, 2024
1 parent a83145f commit 527b339
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class ActiveProjectNodeFolderStatJob(
override fun beforeRunProject(projectId: String) {
if (properties.userMemory) return
// 每次任务启动前要将redis上对应的key清理, 避免干扰
val key = KEY_PREFIX + FolderUtils.buildCacheKey(projectId = projectId, repoName = StringPool.EMPTY)
val key = KEY_PREFIX + StringPool.COLON +
FolderUtils.buildCacheKey(projectId = projectId, repoName = StringPool.EMPTY)
nodeFolderStat.removeRedisKey(key)
}

Expand Down Expand Up @@ -118,7 +119,7 @@ class ActiveProjectNodeFolderStatJob(
)
}

logger.info("store memory cache to db with projectId $projectId")
logger.info("store cache to db with projectId $projectId")
if (properties.userMemory) {
nodeFolderStat.storeMemoryCacheToDB(context, collection, projectId)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class InactiveProjectNodeFolderStatJob(
if (properties.userMemory) return
// 每次任务启动前要将redis上对应的key清理, 避免干扰
collectionNames().forEach {
val key = KEY_PREFIX + FolderUtils.buildCacheKey(
val key = KEY_PREFIX + StringPool.COLON + FolderUtils.buildCacheKey(
collectionName = it, projectId = StringPool.EMPTY
)
nodeFolderStat.removeRedisKey(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class NodeFolderStat(
if (context.folderCache.isEmpty()) return
val movedToRedis: MutableList<String> = mutableListOf()
val storedFolderPrefix = if (collectionName.isNullOrEmpty()) {
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId)
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId)+StringPool.COLON
} else {
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = StringPool.EMPTY)
}
Expand All @@ -163,7 +163,7 @@ class NodeFolderStat(
projectId = folderInfo.projectId, repoName = folderInfo.repoName,
fullPath = folderInfo.fullPath, tag = NODE_NUM
)
val key = keyPrefix + FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId)
val key = keyPrefix + StringPool.COLON + FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId)
// hkey为projectId:repoName:fullPath:size或者nodenum, hvalue为对应值,
hashCommands.hIncrBy(key.toByteArray(), sizeHKey.toByteArray(), entry.value.capSize.toLong())
hashCommands.hIncrBy(key.toByteArray(), nodeNumHKey.toByteArray(), entry.value.nodeNum.toLong())
Expand Down Expand Up @@ -245,7 +245,7 @@ class NodeFolderStat(
} else {
FolderUtils.buildCacheKey(collectionName = null, projectId = projectId)
}
val key = keyPrefix + keySuffix
val key = keyPrefix + StringPool.COLON + keySuffix
storeRedisCacheToDB(key, collectionName, runCollection)
}

Expand Down

0 comments on commit 527b339

Please sign in to comment.