mirror of https://github.com/sbt/sbt.git
Use fixed thread pool
Fixes #274 In #249 parallel download switched to using its own thread pool. It could potentially lead to unbounded download if nobody throttled. This works around the issue by fixing the number of thread to 6, which is a common per-host max connection count.
This commit is contained in:
parent
92f8b75557
commit
29183f2fad
|
|
@ -19,8 +19,12 @@ private[ivyint] case class DownloadResult(dep: IvyNode,
|
|||
totalSizeDownloaded: Long)
|
||||
|
||||
object ParallelResolveEngine {
|
||||
private val resolveExecutionContext =
|
||||
ExecutionContext.fromExecutor(Executors.newCachedThreadPool())
|
||||
private lazy val resolveExecutionContext: ExecutionContext = {
|
||||
// This throttles the connection number, especially when Gigahorse is not used.
|
||||
val maxConnectionCount = 6
|
||||
val executor = Executors.newFixedThreadPool(maxConnectionCount)
|
||||
ExecutionContext.fromExecutor(executor)
|
||||
}
|
||||
}
|
||||
|
||||
/** Define an ivy [[ResolveEngine]] that resolves dependencies in parallel. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue