From d39d3e37d7b9eb8d50dcab806660c42265307dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Fri, 17 Jun 2022 19:55:02 +0200 Subject: [PATCH] limit duplicated progress reports when we get too many notifications from BSD (ci skip) --- .../scala/bleep/internal/BspClientDisplayProgress.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bleep-core/src/main/scala/bleep/internal/BspClientDisplayProgress.scala b/bleep-core/src/main/scala/bleep/internal/BspClientDisplayProgress.scala index 287797078..185547858 100644 --- a/bleep-core/src/main/scala/bleep/internal/BspClientDisplayProgress.scala +++ b/bleep-core/src/main/scala/bleep/internal/BspClientDisplayProgress.scala @@ -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)) @@ -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 =