Skip to content

Commit

Permalink
limit duplicated progress reports when we get too many notifications …
Browse files Browse the repository at this point in the history
…from BSD (ci skip)
  • Loading branch information
oyvindberg committed Jun 17, 2022
1 parent 8e4422b commit d39d3e3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class BspClientDisplayProgress(
}

val DisplayN = 4
var lastProgress = Option.empty[String]
def render(): Unit =
logger.progressMonitor.foreach { pm =>
val byMostProgress = active.toList.sortBy(_._2.fold(0L)(-_.getProgress))
Expand All @@ -51,7 +52,13 @@ class BspClientDisplayProgress(
Str.join(List(renderBuildTarget(buildTargetId), ": ", percentage))
}
.mkString("Compiling ", ", ", (if (rest.isEmpty) "" else s" +${rest.size}"))
pm.info(progress)

// avoid duplicate lines. very visible on web-based terminals which don't erase lines
if (lastProgress.contains(progress)) ()
else {
lastProgress = Some(progress)
pm.info(progress)
}
}

def renderBuildTarget(buildTargetId: BuildTargetIdentifier): Str =
Expand Down

0 comments on commit d39d3e3

Please sign in to comment.