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 8, 2024
1 parent 1fd311d commit da9c32a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ class ActiveProjectNodeFolderStatJob(

companion object {
private val logger = LoggerFactory.getLogger(ActiveProjectNodeFolderStatJob::class.java)
private val KEY_PREFIX = "activeProjectNode"
private const val KEY_PREFIX = "activeProjectNode"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class EmptyFolderCleanup(
if (context.folders.isEmpty()) return
val movedToRedis: MutableList<String> = mutableListOf()
val storedFolderPrefix = if (collectionName.isNullOrEmpty()) {
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId)+StringPool.COLON
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId) + StringPool.COLON
} else {
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = StringPool.EMPTY)
}
Expand All @@ -154,7 +154,9 @@ class EmptyFolderCleanup(
fullPath = folderInfo.fullPath, tag = NODE_NUM
)

val key = keyPrefix + StringPool.COLON + FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId)
val key = keyPrefix + StringPool.COLON + FolderUtils.buildCacheKey(
collectionName = collectionName, projectId = projectId
)
hashCommands.hIncrBy(key.toByteArray(), nodeNumHKey.toByteArray(), entry.value.nodeNum.toLong())
entry.value.id?.let {
val idHKey = FolderUtils.buildCacheKey(
Expand Down Expand Up @@ -250,7 +252,7 @@ class EmptyFolderCleanup(
deleteFolderRepos: List<String>,
id: String,
context: EmptyFolderCleanupJobContext,
) {
) {
if (emptyFolderDoubleCheck(
projectId = folderInfo.projectId,
repoName = folderInfo.repoName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ class InactiveProjectEmptyFolderCleanupJob(
private val logger = LoggerFactory.getLogger(InactiveProjectEmptyFolderCleanupJob::class.java)
const val FULL_PATH_IDX = "projectId_repoName_fullPath_idx"
private const val COLLECTION_NAME_PREFIX = "node_"
private val KEY_PREFIX = "inactiveEmptyFolder"
private const val KEY_PREFIX = "inactiveEmptyFolder"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class InactiveProjectNodeFolderStatJob(
companion object {
private val logger = LoggerFactory.getLogger(InactiveProjectNodeFolderStatJob::class.java)
private const val COLLECTION_NAME_PREFIX = "node_"
private val KEY_PREFIX = "inactiveProjectNode"
private const val KEY_PREFIX = "inactiveProjectNode"

}
}
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)+StringPool.COLON
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = projectId) + StringPool.COLON
} else {
FolderUtils.buildCacheKey(collectionName = collectionName, projectId = StringPool.EMPTY)
}
Expand All @@ -163,7 +163,9 @@ class NodeFolderStat(
projectId = folderInfo.projectId, repoName = folderInfo.repoName,
fullPath = folderInfo.fullPath, tag = NODE_NUM
)
val key = keyPrefix + StringPool.COLON + 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

0 comments on commit da9c32a

Please sign in to comment.