Skip to content

Commit

Permalink
Cancel previous BEP upload if there is a connectivity problem.
Browse files Browse the repository at this point in the history
This should reduce the delay in waiting for the previous command to complete.

RELNOTES: None.
PiperOrigin-RevId: 251247368
  • Loading branch information
susinmotion authored and copybara-github committed Jun 3, 2019
1 parent b0403a7 commit fded729
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ private void waitForPreviousInvocation() {
return;
}

ConnectivityStatus status = connectivityProvider.getStatus(CONNECTIVITY_CACHE_KEY);
if (status.status != ConnectivityStatus.Status.OK) {
reporter.handle(
Event.info(
String.format(
"The Build Event Protocol encountered a connectivity problem: %s. Cancelling"
+ " previous background uploads",
status)));
cancelPendingUploads();
return;
}

Stopwatch stopwatch = Stopwatch.createStarted();
try {
// TODO(b/234994611): It would be better to report before we wait, but the current
Expand Down Expand Up @@ -616,8 +628,7 @@ private BuildEventServiceTransport createBesTransport(
clearBesClient();
String message =
String.format(
"Build Event Service uploads disabled due to a connectivity problem: %s",
status.toString());
"Build Event Service uploads disabled due to a connectivity problem: %s", status);
reporter.handle(Event.warn(message));
googleLogger.atWarning().log(message);
return null;
Expand Down

0 comments on commit fded729

Please sign in to comment.