From f6154ca660617513feb9b822143b01a7fc5eb6ec Mon Sep 17 00:00:00 2001 From: def7 Date: Thu, 14 Oct 2021 13:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=A8=E7=BA=BF=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=AE=8C=E6=88=90=E5=90=8E=E5=9B=9E=E8=B0=83=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socket/handler/NodeUpdateHandler.java | 23 +++++++++++++++++++ web-vue/src/pages/node/update.vue | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/server/src/main/java/io/jpom/socket/handler/NodeUpdateHandler.java b/modules/server/src/main/java/io/jpom/socket/handler/NodeUpdateHandler.java index d9c090874..47281b76b 100644 --- a/modules/server/src/main/java/io/jpom/socket/handler/NodeUpdateHandler.java +++ b/modules/server/src/main/java/io/jpom/socket/handler/NodeUpdateHandler.java @@ -198,6 +198,29 @@ public class NodeUpdateHandler extends BaseProxyHandler { } WebSocketMessageModel restartMessage = new WebSocketMessageModel("restart", id); client.send(restartMessage.toString()); + // 重启后尝试访问插件端,能够连接说明重启完毕 + ThreadUtil.execute(() -> { + WebSocketMessageModel callbackRestartMessage = new WebSocketMessageModel("restart", id); + int retryCount = 0; + try { + // 先等待一会,太快可能还没重启 + Thread.sleep(10000L); + while (retryCount <= 30) { + ++retryCount; + try { + Thread.sleep(1000L); + if (client.reconnectBlocking()) { + this.sendMsg(callbackRestartMessage.setData("重启完成"), session); + return; + } + } catch (Exception e) {} + } + this.sendMsg(callbackRestartMessage.setData("重连失败"), session); + } catch (Exception e) { + DefaultSystemLog.getLog().error("升级后重连插件端失败:" + model, e); + this.sendMsg(callbackRestartMessage.setData("重连插件端失败"), session); + } + }); } else { this.sendMsg(model.setData("节点连接丢失"), session); } diff --git a/web-vue/src/pages/node/update.vue b/web-vue/src/pages/node/update.vue index ae4dad3ca..92744f48b 100644 --- a/web-vue/src/pages/node/update.vue +++ b/web-vue/src/pages/node/update.vue @@ -27,7 +27,7 @@ {{ text | version }}