Skip to content

Commit

Permalink
chore(downloader): Add a debug log when deleting working tree caches
Browse files Browse the repository at this point in the history
This is supposed to help debugging issues like [1].

[1]: #8987

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Aug 14, 2024
1 parent 743873a commit dfa843c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion downloader/src/main/kotlin/WorkingTreeCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import java.io.IOException
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock

import org.apache.logging.log4j.kotlin.logger

import org.ossreviewtoolkit.model.VcsInfo
import org.ossreviewtoolkit.utils.common.safeDeleteRecursively
import org.ossreviewtoolkit.utils.ort.createOrtTempDir
Expand Down Expand Up @@ -89,7 +91,13 @@ class DefaultWorkingTreeCache : WorkingTreeCache {

workingTreeMutexes.forEach { (key, workingTreeMutex) ->
workingTreeMutex.withLock {
workingTrees[key]?.getRootPath()?.safeDeleteRecursively(force = true)
workingTrees[key]?.run {
logger.debug {
"Deleting cached working tree for ${getRemoteUrl()} from '${getRootPath()}'..."
}

getRootPath().safeDeleteRecursively(force = true)
}
}
}

Expand Down

0 comments on commit dfa843c

Please sign in to comment.