@abtnode/util 1.17.3-beta-20251117-230305-4637416e → 1.17.3-beta-20251119-034511-f26047c0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const net = require('net');
|
|
1
|
+
const net = require('node:net');
|
|
2
2
|
const debug = require('debug')('@abtnode/util:ensure-endpoint-healthy');
|
|
3
3
|
|
|
4
4
|
const sleep = require('./sleep');
|
|
@@ -7,19 +7,26 @@ const tryWithTimeout = require('./try-with-timeout');
|
|
|
7
7
|
const ONE_SECOND = 1000;
|
|
8
8
|
const WAIT_TCP_TIME = 3000;
|
|
9
9
|
|
|
10
|
-
const dial = (host, port) =>
|
|
10
|
+
const dial = (host, port, timeout = 3 * 1000) =>
|
|
11
11
|
new Promise((resolve, reject) => {
|
|
12
12
|
const socket = net.connect({
|
|
13
13
|
host: host || '127.0.0.1',
|
|
14
14
|
port,
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
const overallTimeout = setTimeout(() => {
|
|
18
|
+
socket.destroy();
|
|
19
|
+
reject(new Error(`Connection timeout after ${timeout}ms`));
|
|
20
|
+
}, timeout);
|
|
21
|
+
|
|
17
22
|
socket.on('connect', () => {
|
|
23
|
+
clearTimeout(overallTimeout);
|
|
18
24
|
socket.destroy();
|
|
19
25
|
resolve();
|
|
20
26
|
});
|
|
21
27
|
|
|
22
28
|
socket.on('error', (error) => {
|
|
29
|
+
clearTimeout(overallTimeout);
|
|
23
30
|
reject(error);
|
|
24
31
|
});
|
|
25
32
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.3-beta-
|
|
6
|
+
"version": "1.17.3-beta-20251119-034511-f26047c0",
|
|
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-
|
|
22
|
-
"@abtnode/db-cache": "1.17.3-beta-
|
|
21
|
+
"@abtnode/constant": "1.17.3-beta-20251119-034511-f26047c0",
|
|
22
|
+
"@abtnode/db-cache": "1.17.3-beta-20251119-034511-f26047c0",
|
|
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-
|
|
26
|
+
"@blocklet/constant": "1.17.3-beta-20251119-034511-f26047c0",
|
|
27
27
|
"@blocklet/error": "^0.3.3",
|
|
28
|
-
"@blocklet/meta": "1.17.3-beta-
|
|
28
|
+
"@blocklet/meta": "1.17.3-beta-20251119-034511-f26047c0",
|
|
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": "
|
|
93
|
+
"gitHead": "7ab331f3b29e171a1e02aca80e73f35b6a161b86"
|
|
94
94
|
}
|