Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamet committed Nov 23, 2023
1 parent e35bb73 commit dc2fb45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bridge/src/main/scala/protocbridge/FileCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ final class FileCache[K](
def get(key: K): Future[File] = {
val f = fileForKey(key)
val cm = completeMarker(key)
println(s"*** key=$key: ${cm.getAbsolutePath()}=${cm.exists()} and ${f.getAbsolutePath()}=${f.exists()}")
println(s"*** key=$key: ${cm.getAbsolutePath()}=${cm.exists()} and ${f
.getAbsolutePath()}=${f.exists()}")
if (cm.exists() && f.exists()) {
f.setExecutable(true)
Future.successful(f)
} else {
val p = Promise[File]()
val prev = tasks.putIfAbsent(key, p)
println(s"*** t=${this} hc=${key.hashCode} key=$key prev=$prev")
if (prev == null) {
println(
s"*** Downloading: t=${this} hc=${key.hashCode} key=${key} prev=$prev"
)
// we are the first
val tmpDir = Files.createTempDirectory("protocbridge").toFile
doGet(tmpDir, key).map(copyToCache(_, f)).onComplete {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import coursier.core.Extension
object CoursierProtocCache {
val cache: FileCache[Dependency] = {
val x = new FileCache(FileCache.cacheDir, download, filenameFromKey)
println("*** Creating a new filecache: $x")
println(s"*** Creating a new filecache: $x")
x
}

Expand Down

0 comments on commit dc2fb45

Please sign in to comment.