|
20 | 20 | * IN THE SOFTWARE.
|
21 | 21 | */
|
22 | 22 |
|
23 |
| -// TODO(aduh95): remove restricted syntax errors |
24 |
| -/* eslint-disable no-restricted-syntax */ |
25 |
| - |
26 | 23 | 'use strict';
|
27 | 24 |
|
28 | 25 | const {
|
@@ -53,8 +50,8 @@ const { EventEmitter } = require('events');
|
53 | 50 | const net = require('net');
|
54 | 51 | const util = require('util');
|
55 | 52 | const {
|
56 |
| - setInterval, |
57 |
| - setTimeout, |
| 53 | + setInterval: pSetInterval, |
| 54 | + setTimeout: pSetTimeout, |
58 | 55 | } = require('timers/promises');
|
59 | 56 | const {
|
60 | 57 | AbortController,
|
@@ -85,13 +82,13 @@ async function portIsFree(host, port, timeout = 9999) {
|
85 | 82 | const ac = new AbortController();
|
86 | 83 | const { signal } = ac;
|
87 | 84 |
|
88 |
| - setTimeout(timeout).then(() => ac.abort()); |
| 85 | + pSetTimeout(timeout).then(() => ac.abort()); |
89 | 86 |
|
90 |
| - const asyncIterator = setInterval(retryDelay); |
| 87 | + const asyncIterator = pSetInterval(retryDelay); |
91 | 88 | while (true) {
|
92 | 89 | await asyncIterator.next();
|
93 | 90 | if (signal.aborted) {
|
94 |
| - throw new StartupError( |
| 91 | + throw new StartupError( // eslint-disable-line no-restricted-syntax |
95 | 92 | `Timeout (${timeout}) waiting for ${host}:${port} to be free`);
|
96 | 93 | }
|
97 | 94 | const error = await new Promise((resolve) => {
|
@@ -251,7 +248,7 @@ class NodeInspector {
|
251 | 248 | return;
|
252 | 249 | } catch (error) {
|
253 | 250 | debuglog('connect failed', error);
|
254 |
| - await setTimeout(1000); |
| 251 | + await pSetTimeout(1000); |
255 | 252 | }
|
256 | 253 | }
|
257 | 254 | this.stdout.write(' failed to connect, please retry\n');
|
|
0 commit comments