|
|
@@ -57,7 +57,20 @@ public class DeployJob {
|
|
|
|
|
|
log.info(">>> [Step 4] 正在轮询健康检查...");
|
|
|
int maxRetries = 5; // 假设尝试 5 次,每次 2s
|
|
|
- for (int i = 0; i < maxRetries; i++) {
|
|
|
+ runStep(ctx, DeployStepName.HEALTH_CHECK.name(), () -> {
|
|
|
+ for (int i = 0; i < maxRetries; i++) {
|
|
|
+ try (Socket socket = new Socket()) {
|
|
|
+ // 仅检测 TCP 端口是否开放,无需 curl
|
|
|
+ String host = "localhost";
|
|
|
+ socket.connect(new InetSocketAddress(host, appPort), 2000);
|
|
|
+ //healthCheck = true;
|
|
|
+ } catch (IOException e) {
|
|
|
+ //throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ try { Thread.sleep(2000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*for (int i = 0; i < maxRetries; i++) {
|
|
|
runStep(ctx, DeployStepName.HEALTH_CHECK.name(), () -> {
|
|
|
try (Socket socket = new Socket()) {
|
|
|
// 仅检测 TCP 端口是否开放,无需 curl
|
|
|
@@ -69,8 +82,7 @@ public class DeployJob {
|
|
|
}
|
|
|
});
|
|
|
try { Thread.sleep(2000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
|
|
|
- }
|
|
|
-
|
|
|
+ }*/
|
|
|
runStep(ctx, DeployStepName.DEPLOY_DONE.name(), () -> {
|
|
|
log.info(">>> [Step 5] 上报部署状态...");
|
|
|
InspectContainerResponse inspectContainerResponse = DockerManager.getDocker().inspectContainer(appId);
|