ee-core 2.9.0-beta.1 → 2.9.1
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/cross/index.js +4 -0
- package/cross/spawnProcess.js +4 -5
- package/ee/eeApp.js +7 -6
- package/package.json +1 -1
package/cross/index.js
CHANGED
|
@@ -85,6 +85,10 @@ const CrossLanguageService = {
|
|
|
85
85
|
// format params
|
|
86
86
|
let tmpArgs = targetConf.args;
|
|
87
87
|
let confPort = parseInt(Helper.getValueFromArgv(tmpArgs, 'port'));
|
|
88
|
+
// 某些程序给它传入不存在的参数时会报错
|
|
89
|
+
if (isNaN(confPort) && targetConf.port > 0) {
|
|
90
|
+
confPort = targetConf.port;
|
|
91
|
+
}
|
|
88
92
|
if (confPort > 0) {
|
|
89
93
|
// 动态生成port,传入的端口必须为int
|
|
90
94
|
confPort = await GetPort({ port: confPort });
|
package/cross/spawnProcess.js
CHANGED
|
@@ -27,12 +27,7 @@ class SpawnProcess {
|
|
|
27
27
|
_init(options = {}) {
|
|
28
28
|
const { targetConf, port } = options;
|
|
29
29
|
this.config = targetConf;
|
|
30
|
-
|
|
31
30
|
this.port = port;
|
|
32
|
-
// 某些程序给它传入不存在的参数时会报错
|
|
33
|
-
if (isNaN(port) && targetConf.port > 0) {
|
|
34
|
-
this.port = targetConf.port;
|
|
35
|
-
}
|
|
36
31
|
|
|
37
32
|
// 该名称如果在childrenMap重复,会被重写
|
|
38
33
|
this.name = targetConf.name;
|
|
@@ -159,6 +154,10 @@ class SpawnProcess {
|
|
|
159
154
|
return obj;
|
|
160
155
|
}
|
|
161
156
|
|
|
157
|
+
setPort(port) {
|
|
158
|
+
this.port = parseInt(port);
|
|
159
|
+
}
|
|
160
|
+
|
|
162
161
|
_generateId() {
|
|
163
162
|
const rid = Helper.getRandomString();
|
|
164
163
|
return `node:${this.pid}:${rid}`;
|
package/ee/eeApp.js
CHANGED
|
@@ -17,6 +17,7 @@ const GetPort = require('../utils/get-port');
|
|
|
17
17
|
const UtilsHelper = require('../utils/helper');
|
|
18
18
|
const HttpClient = require('../httpclient');
|
|
19
19
|
const Cross = require('../cross');
|
|
20
|
+
const Html = require('../html');
|
|
20
21
|
|
|
21
22
|
class EeApp extends BaseApp {
|
|
22
23
|
constructor(options = {}) {
|
|
@@ -146,16 +147,17 @@ class EeApp extends BaseApp {
|
|
|
146
147
|
// 检查 UI serve是否启动,先加载一个boot page
|
|
147
148
|
if (load == 'url') {
|
|
148
149
|
// loading page
|
|
149
|
-
let lp =
|
|
150
|
+
let lp = Html.getFilepath('boot.html');
|
|
150
151
|
if (electronCfg.hasOwnProperty('loadingPage') && electronCfg.loadingPage != '') {
|
|
151
152
|
lp = path.join(this.config.homeDir, electronCfg.loadingPage);
|
|
152
153
|
}
|
|
153
154
|
this._loadingPage(lp);
|
|
154
155
|
|
|
156
|
+
const retryTimes = modeInfo.force === true ? 3 : 60;
|
|
155
157
|
let count = 0;
|
|
156
158
|
let frontendReady = false;
|
|
157
159
|
const hc = new HttpClient();
|
|
158
|
-
while(!frontendReady && count <
|
|
160
|
+
while(!frontendReady && count < retryTimes){
|
|
159
161
|
await UtilsHelper.sleep(1 * 1000);
|
|
160
162
|
try {
|
|
161
163
|
await hc.request(url, {
|
|
@@ -170,8 +172,8 @@ class EeApp extends BaseApp {
|
|
|
170
172
|
count++;
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
if (frontendReady == false) {
|
|
174
|
-
const bootFailurePage =
|
|
175
|
+
if (frontendReady == false && modeInfo.force !== true) {
|
|
176
|
+
const bootFailurePage = Html.getFilepath('failure.html');
|
|
175
177
|
this.mainWindow.loadFile(bootFailurePage);
|
|
176
178
|
Log.coreLogger.error(`[ee-core] Please check the ${url} !`);
|
|
177
179
|
return;
|
|
@@ -248,7 +250,7 @@ class EeApp extends BaseApp {
|
|
|
248
250
|
}
|
|
249
251
|
//console.log('count:', count)
|
|
250
252
|
if (serviceReady == false) {
|
|
251
|
-
const bootFailurePage =
|
|
253
|
+
const bootFailurePage = Html.getFilepath('cross-failure.html');
|
|
252
254
|
this.mainWindow.loadFile(bootFailurePage);
|
|
253
255
|
throw new Error(`[ee-core] Please check cross service [${service}] ${url} !`)
|
|
254
256
|
}
|
|
@@ -331,7 +333,6 @@ class EeApp extends BaseApp {
|
|
|
331
333
|
if (!UtilsHelper.fileIsExist(name)) {
|
|
332
334
|
return
|
|
333
335
|
}
|
|
334
|
-
|
|
335
336
|
this.mainWindow.loadFile(name);
|
|
336
337
|
}
|
|
337
338
|
|