Skip to content

Commit

Permalink
feat: 统计清理的空目录个数 #1209
Browse files Browse the repository at this point in the history
  • Loading branch information
zacYL committed Oct 10, 2023
1 parent 40ad075 commit d38ab22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import java.util.concurrent.atomic.LongAdder
class EmptyFolderChildContext(
parentContent: JobContext,
// 用于内存缓存下存储目录统计信息
var folders: ConcurrentHashMap<String, FolderMetricsInfo> = ConcurrentHashMap()
var folders: ConcurrentHashMap<String, FolderMetricsInfo> = ConcurrentHashMap(),
// 总共删除的路径个数
var totalDeletedNum: LongAdder = LongAdder()
): ChildJobContext(parentContent) {

data class FolderMetricsInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class EmptyFolderCleanupJob(
}

override fun onParentJobFinished(context: ChildJobContext) {
logger.info("emptyFolderCleanupJob finished")
require(context is EmptyFolderChildContext)
logger.info("emptyFolderCleanupJob finished, deleted empty folder num: ${context.totalDeletedNum}")
}


Expand Down Expand Up @@ -129,6 +130,7 @@ class EmptyFolderCleanupJob(
collectionName = collectionName
)) {
logger.info("will delete empty folder ${it.fullPath} in repo ${it.projectId}|${it.repoName}")
context.totalDeletedNum.increment()
deleteEmptyFolders(entry.value.id, collectionName)
}
}
Expand Down

0 comments on commit d38ab22

Please sign in to comment.