@abtnode/util 1.16.49-beta-20250822-070545-6d3344cc → 1.16.49-beta-20250826-112154-8ca981fa
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.
|
@@ -53,23 +53,6 @@ function waitProcOnlineById(id, timeout = 20_000) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/** 等待该 app 的 cluster 全 online */
|
|
57
|
-
function waitSomeInstancesOnline(name, instances, timeoutMs = 20_000) {
|
|
58
|
-
const start = Date.now();
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
(function poll() {
|
|
61
|
-
pm2.list((err, list) => {
|
|
62
|
-
if (err) return reject(err);
|
|
63
|
-
const procs = list.filter((p) => p.name === name);
|
|
64
|
-
const online = procs.filter((p) => p.pm2_env?.status === 'online').length;
|
|
65
|
-
if (online >= instances) return resolve();
|
|
66
|
-
if (Date.now() - start > timeoutMs) return reject(new Error('instances not online in time'));
|
|
67
|
-
setTimeout(poll, 120);
|
|
68
|
-
});
|
|
69
|
-
})();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
56
|
async function rollingRestartWithEnv(config) {
|
|
74
57
|
// eslint-disable-next-line camelcase
|
|
75
58
|
const { name, listen_timeout = 20_000 } = config;
|
|
@@ -126,12 +109,10 @@ async function pm2StartOrReload(config = {}) {
|
|
|
126
109
|
} else {
|
|
127
110
|
await pm2.startAsync(config);
|
|
128
111
|
}
|
|
129
|
-
await waitSomeInstancesOnline(name, config.instances);
|
|
130
112
|
}
|
|
131
113
|
|
|
132
114
|
module.exports = {
|
|
133
115
|
loadReloadEnv,
|
|
134
116
|
isProcessRunningByPm2,
|
|
135
|
-
waitSomeInstancesOnline,
|
|
136
117
|
pm2StartOrReload,
|
|
137
118
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.49-beta-
|
|
6
|
+
"version": "1.16.49-beta-20250826-112154-8ca981fa",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.16.49-beta-
|
|
22
|
-
"@abtnode/db-cache": "1.16.49-beta-
|
|
21
|
+
"@abtnode/constant": "1.16.49-beta-20250826-112154-8ca981fa",
|
|
22
|
+
"@abtnode/db-cache": "1.16.49-beta-20250826-112154-8ca981fa",
|
|
23
23
|
"@arcblock/did": "1.22.2",
|
|
24
24
|
"@arcblock/event-hub": "1.22.2",
|
|
25
25
|
"@arcblock/pm2": "^6.0.12",
|
|
26
|
-
"@blocklet/constant": "1.16.49-beta-
|
|
26
|
+
"@blocklet/constant": "1.16.49-beta-20250826-112154-8ca981fa",
|
|
27
27
|
"@blocklet/error": "^0.2.5",
|
|
28
|
-
"@blocklet/meta": "1.16.49-beta-
|
|
28
|
+
"@blocklet/meta": "1.16.49-beta-20250826-112154-8ca981fa",
|
|
29
29
|
"@blocklet/xss": "^0.2.5",
|
|
30
30
|
"@ocap/client": "1.22.2",
|
|
31
31
|
"@ocap/mcrypto": "1.22.2",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"fs-extra": "^11.2.0",
|
|
92
92
|
"jest": "^29.7.0"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "f31434546e024c4ce20a1d3c0d34b64f12980536"
|
|
95
95
|
}
|