@abtnode/util 1.17.3-beta-20251119-102907-28b69b76 → 1.17.3-beta-20251121-135300-8e451e6e

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.
@@ -112,7 +112,7 @@ const ensureStarted = async ({
112
112
  debug('ping if started', { port });
113
113
  return true;
114
114
  } catch (err) {
115
- console.error('ping error, need to retry:', host, port, err.message);
115
+ debug('ping error:', err.message, port);
116
116
  await sleep(ONE_SECOND);
117
117
 
118
118
  const spend = elapse + (Date.now() - startTime);
@@ -133,6 +133,7 @@ module.exports = async ({
133
133
  minConsecutiveTime = (+process.env.ENDPOINT_CONSECUTIVE_TIME || 5) * ONE_SECOND,
134
134
  doConsecutiveCheck = true,
135
135
  waitTCP = false,
136
+ shouldAbort,
136
137
  // eslint-disable-next-line require-await
137
138
  }) => {
138
139
  debug('ensure endpoint healthy', { host, port, protocol, timeout, minConsecutiveTime, doConsecutiveCheck });
@@ -142,7 +143,24 @@ module.exports = async ({
142
143
  }
143
144
 
144
145
  const fn = async () => {
145
- await ensureStarted({ host, port, protocol, timeout: timeout - minConsecutiveTime, minConsecutiveTime, waitTCP });
146
+ // Check shouldAbort before starting, to ensure process exists
147
+ if (shouldAbort) {
148
+ // eslint-disable-next-line no-useless-catch
149
+ try {
150
+ await shouldAbort();
151
+ } catch (abortError) {
152
+ throw abortError;
153
+ }
154
+ }
155
+ await ensureStarted({
156
+ host,
157
+ port,
158
+ protocol,
159
+ timeout: timeout - minConsecutiveTime,
160
+ minConsecutiveTime,
161
+ waitTCP,
162
+ shouldAbort,
163
+ });
146
164
  if (doConsecutiveCheck) {
147
165
  try {
148
166
  await ensureStarted({
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.17.3-beta-20251119-102907-28b69b76",
6
+ "version": "1.17.3-beta-20251121-135300-8e451e6e",
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.17.3-beta-20251119-102907-28b69b76",
22
- "@abtnode/db-cache": "1.17.3-beta-20251119-102907-28b69b76",
21
+ "@abtnode/constant": "1.17.3-beta-20251121-135300-8e451e6e",
22
+ "@abtnode/db-cache": "1.17.3-beta-20251121-135300-8e451e6e",
23
23
  "@arcblock/did": "^1.27.7",
24
24
  "@arcblock/event-hub": "^1.27.7",
25
25
  "@arcblock/pm2": "^6.0.12",
26
- "@blocklet/constant": "1.17.3-beta-20251119-102907-28b69b76",
26
+ "@blocklet/constant": "1.17.3-beta-20251121-135300-8e451e6e",
27
27
  "@blocklet/error": "^0.3.3",
28
- "@blocklet/meta": "1.17.3-beta-20251119-102907-28b69b76",
28
+ "@blocklet/meta": "1.17.3-beta-20251121-135300-8e451e6e",
29
29
  "@blocklet/xss": "^0.3.9",
30
30
  "@ocap/client": "^1.27.7",
31
31
  "@ocap/mcrypto": "^1.27.7",
@@ -90,5 +90,5 @@
90
90
  "express": "^4.18.2",
91
91
  "fs-extra": "^11.2.0"
92
92
  },
93
- "gitHead": "6ae74784386f183ac410a226b6b9334c0f722fcc"
93
+ "gitHead": "e34d7abbe02a8b6eb754b7e2590a9e3d9d663c7d"
94
94
  }