Skip to content

Commit

Permalink
debug: Add more debug information and cancel all current state in Com…
Browse files Browse the repository at this point in the history
…pilations
  • Loading branch information
tgodzik committed Nov 19, 2024
1 parent 3511d80 commit d1fce17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ final class BatchedFunction[A, B](
private def unlock(): Unit = {
lock.set(None)
if (!queue.isEmpty) {
scribe.debug(s"Queue $functionId is empty, running acquire")
runAcquire()
}
}
Expand Down Expand Up @@ -143,6 +144,7 @@ final class BatchedFunction[A, B](
if (requests.nonEmpty) {
val args = requests.flatMap(_.arguments)
val callbacks = requests.map(_.callback)
scribe.debug(s"Running function inside queue $functionId")
val result = fn(args)
this.current.set(result)
val resultF = for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ final class Compilations(
} yield ()

def cancel(): Unit = {
isCompiling.clear()
lastCompile = Set.empty
cascadeBatch.cancelAll()
compileBatch.cancelAll()
}
Expand Down Expand Up @@ -238,6 +240,9 @@ final class Compilations(

targetsByBuildServer.toList match {
case Nil =>
scribe.debug(
s"No compilation targets found for ${targets.mkString(", ")}"
)
Future
.successful(Map.empty[BuildTargetIdentifier, b.CompileResult])
.asCancelable
Expand All @@ -258,6 +263,7 @@ final class Compilations(
targets: Seq[b.BuildTargetIdentifier],
timeout: Option[Timeout],
): CancelableFuture[b.CompileResult] = {
scribe.debug("Compiling " + targets.mkString(", "))
val originId = "METALS-$" + UUID.randomUUID().toString
val params = new b.CompileParams(targets.asJava)
params.setOriginId(originId)
Expand Down

0 comments on commit d1fce17

Please sign in to comment.