Merge branch 'develop' into bsp-consolidate

This commit is contained in:
Ethan Atkins 2020-11-20 07:29:35 -08:00 committed by GitHub
commit 8ee28d5693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -179,11 +179,15 @@ private[sbt] abstract class AbstractBackgroundJobService extends BackgroundJobSe
override final def close(): Unit = shutdown()
override def shutdown(): Unit = {
while (jobSet.nonEmpty) {
val deadline = 10.seconds.fromNow
while (jobSet.nonEmpty && !deadline.isOverdue) {
jobSet.headOption.foreach {
case handle: ThreadJobHandle @unchecked =>
handle.job.shutdown()
handle.job.awaitTerminationTry(10.seconds)
if (handle.job.isRunning) {
handle.job.shutdown()
handle.job.awaitTerminationTry(10.seconds)
}
jobSet = jobSet - handle
case _ => //
}
}