@@ -36,8 +36,8 @@ import scala.annotation.tailrec
36
36
37
37
object Jvm {
38
38
39
- private val ConcurrentRetryCount = 5
40
- private val ConcurrentRetryWait = 100
39
+ private val CoursierRetryCount = 5
40
+ private val CoursierRetryWait = 100
41
41
42
42
/**
43
43
* Runs a JVM subprocess with the given configuration and returns a
@@ -583,7 +583,7 @@ object Jvm {
583
583
584
584
@ tailrec def load (
585
585
artifacts : Seq [coursier.util.Artifact ],
586
- retry : Int = ConcurrentRetryCount
586
+ retry : Int = CoursierRetryCount
587
587
): (Seq [ArtifactError ], Seq [File ]) = {
588
588
import scala .concurrent .ExecutionContext .Implicits .global
589
589
val loadedArtifacts = Gather [Task ].gather(
@@ -597,12 +597,19 @@ object Jvm {
597
597
}
598
598
val successes = loadedArtifacts.collect { case (_, Right (x)) => x }
599
599
600
- if (retry > 0 && errors.exists(_ .describe.contains(" concurrent download" ))) {
600
+ if (retry > 0 && errors.exists(e => e .describe.contains(" concurrent download" ))) {
601
601
ctx.foreach(_.log.debug(
602
602
s " Detected a concurrent download issue in coursier. Attempting a retry ( ${retry} left) "
603
603
))
604
- Thread .sleep(ConcurrentRetryWait )
604
+ Thread .sleep(CoursierRetryWait )
605
605
load(artifacts, retry - 1 )
606
+ } else if (retry > 0 && errors.exists(e => e.describe.contains(" checksum not found" ))) {
607
+ ctx.foreach(_.log.debug(
608
+ s " Detected a checksum download issue in coursier. Attempting a retry ( ${retry} left) "
609
+ ))
610
+ Thread .sleep(CoursierRetryWait )
611
+ load(artifacts, retry - 1 )
612
+
606
613
} else (errors, successes)
607
614
}
608
615
@@ -683,7 +690,7 @@ object Jvm {
683
690
import scala .concurrent .ExecutionContext .Implicits .global
684
691
685
692
// Workaround for https://github.com/com-lihaoyi/mill/issues/1028
686
- @ tailrec def retriedResolution (count : Int = ConcurrentRetryCount ): Resolution = {
693
+ @ tailrec def retriedResolution (count : Int = CoursierRetryCount ): Resolution = {
687
694
val resolution = start.process.run(fetch).unsafeRun()
688
695
if (
689
696
count > 0 &&
@@ -693,7 +700,7 @@ object Jvm {
693
700
ctx.foreach(_.log.debug(
694
701
s " Detected a concurrent download issue in coursier. Attempting a retry ( ${count} left) "
695
702
))
696
- Thread .sleep(ConcurrentRetryWait )
703
+ Thread .sleep(CoursierRetryWait )
697
704
retriedResolution(count - 1 )
698
705
} else resolution
699
706
}
0 commit comments