diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java index 7653fd892f..0cab34771d 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java @@ -175,7 +175,7 @@ public class BlazeCommandDispatcher { // holding the lock has changed under the hood. There have been multiple bug reports where // users (especially macOS ones) mention that the Blaze invocation hangs on a non-existent PID. // This should help troubleshoot those scenarios in case there really is a bug somewhere. - int attempts = 0; + boolean multipleAttempts = false; long clockBefore = BlazeClock.nanoTime(); String otherClientDescription = ""; synchronized (commandLock) { @@ -183,10 +183,7 @@ public class BlazeCommandDispatcher { switch (lockingMode) { case WAIT: if (!otherClientDescription.equals(currentClientDescription)) { - if (attempts > 0) { - outErr.printErrLn(" lock taken by another command"); - } - outErr.printErr("Another command (" + currentClientDescription + ") is running. " + outErr.printErrLn("Another command (" + currentClientDescription + ") is running. " + " Waiting for it to complete on the server..."); otherClientDescription = currentClientDescription; } @@ -202,18 +199,16 @@ public class BlazeCommandDispatcher { throw new IllegalStateException(); } - attempts += 1; + multipleAttempts = true; } Verify.verify(currentClientDescription == null); currentClientDescription = clientDescription; } - if (attempts > 0) { - outErr.printErrLn(" done!"); - } // If we took the lock on the first try, force the reported wait time to 0 to avoid unnecessary // noise in the logs. In this metric, we are only interested in knowing how long it took for // other commands to complete, not how fast acquiring a lock is. - long waitTimeInMs = attempts == 0 ? 0 : (BlazeClock.nanoTime() - clockBefore) / (1000L * 1000L); + long waitTimeInMs = + !multipleAttempts ? 0 : (BlazeClock.nanoTime() - clockBefore) / (1000L * 1000L); try { if (shutdownReason != null) { |