yymaxapi 1.0.29 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/yymaxapi.js +14 -2
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -2903,9 +2903,21 @@ async function testConnection(paths, args = {}) {
|
|
|
2903
2903
|
|
|
2904
2904
|
// 等待 Gateway 启动
|
|
2905
2905
|
const gwSpinner = ora({ text: '等待 Gateway 启动...', spinner: 'dots' }).start();
|
|
2906
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
2907
2906
|
|
|
2908
|
-
let gatewayRunning =
|
|
2907
|
+
let gatewayRunning = false;
|
|
2908
|
+
|
|
2909
|
+
if (restartOk) {
|
|
2910
|
+
// restartGateway 内部已经验证过端口可达,只需短暂确认
|
|
2911
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
2912
|
+
gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 5000);
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
if (!gatewayRunning) {
|
|
2916
|
+
// restart 失败或未就绪,先等待更长时间(macOS LaunchAgent 启动较慢)
|
|
2917
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
2918
|
+
gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 20000);
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2909
2921
|
if (!gatewayRunning) {
|
|
2910
2922
|
gwSpinner.text = '尝试自动启动 Gateway...';
|
|
2911
2923
|
const autoResult = await tryAutoStartGateway(gatewayPort, allowAutoDaemon);
|