mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
perf(doctor): run checks concurrently and share docker lookups (#32)
This commit is contained in:
1 parent
3c4118ff1a
commit
dd38f6dc27
20 files changed
+623
-51
No files matched your search
@@ -43,7 +43,12 @@ public class FlociHttpClient {
|
||||
}
|
||||
|
||||
public HealthInfo health() throws FlociException {
|
||||
JsonNode node = getJson(controlPrefix + "/health");
|
||||
return health(Duration.ofSeconds(10));
|
||||
}
|
||||
|
||||
/** {@link #health()} with its own request timeout, for probes that must answer quickly. */
|
||||
public HealthInfo health(Duration timeout) throws FlociException {
|
||||
JsonNode node = getJson(controlPrefix + "/health", timeout);
|
||||
return new HealthInfo(
|
||||
node.path("version").asText("unknown"),
|
||||
node.path("original_edition").asText(node.path("edition").asText("community")),
|
||||
@@ -120,10 +125,14 @@ public class FlociHttpClient {
|
||||
}
|
||||
|
||||
private JsonNode getJson(String path) throws FlociException {
|
||||
return getJson(path, Duration.ofSeconds(10));
|
||||
}
|
||||
|
||||
private JsonNode getJson(String path, Duration timeout) throws FlociException {
|
||||
try {
|
||||
HttpRequest req = HttpRequest.newBuilder()
|
||||
.uri(URI.create(endpoint + path))
|
||||
.timeout(Duration.ofSeconds(10))
|
||||
.timeout(timeout)
|
||||
.header("Accept", "application/json")
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
Reference in new issue
Block a user