Skip to content

Commit 4d6468d

Browse files
authored
[Dashboard] Add timeout to block() for HTTP requests to Github (#1751)
There was an incident at Github on Sep 22 that caused one of the HTTP requests we sent to Github never returned and thus blocked the entire sync process. No idea why the underlying HTTP client library didn't throw an error in this case, but we should add a timeout to the `block()` anyway. Fixes #1732.
1 parent 1e4b951 commit 4d6468d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dashboard/server/src/main/java/build/bazel/dashboard/common/RestApiClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.common.base.Strings;
44
import java.net.URI;
5+
import java.time.Duration;
56
import java.util.function.Function;
67
import javax.annotation.Nullable;
78
import lombok.extern.slf4j.Slf4j;
@@ -37,7 +38,7 @@ protected RestApiResponse exchange(WebClient.RequestHeadersSpec<?> spec) {
3738
return spec.exchangeToMono(response -> {
3839
log.debug("{} {}", response.statusCode(), response.headers().asHttpHeaders().toSingleValueMap());
3940
return RestApiResponse.fromClientResponse(response);
40-
}).block();
41+
}).block(Duration.ofSeconds(120));
4142
}
4243

4344
}

0 commit comments

Comments
 (0)