|
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 { |
@@ -56,10 +53,10 @@ const { |
56 | 53 | AbortController, |
57 | 54 | } = require('internal/abort_controller'); |
58 | 55 |
|
59 | | -const setTimeout = util.promisify(require('timers').setTimeout); |
60 | | -async function* setInterval(delay) { |
| 56 | +const pSetTimeout = util.promisify(require('timers').setTimeout); |
| 57 | +async function* pSetInterval(delay) { |
61 | 58 | while (true) { |
62 | | - await setTimeout(delay); |
| 59 | + await pSetTimeout(delay); |
63 | 60 | yield; |
64 | 61 | } |
65 | 62 | } |
@@ -89,13 +86,13 @@ async function portIsFree(host, port, timeout = 9999) { |
89 | 86 | const ac = new AbortController(); |
90 | 87 | const { signal } = ac; |
91 | 88 |
|
92 | | - setTimeout(timeout).then(() => ac.abort()); |
| 89 | + pSetTimeout(timeout).then(() => ac.abort()); |
93 | 90 |
|
94 | | - const asyncIterator = setInterval(retryDelay); |
| 91 | + const asyncIterator = pSetInterval(retryDelay); |
95 | 92 | while (true) { |
96 | 93 | await asyncIterator.next(); |
97 | 94 | if (signal.aborted) { |
98 | | - throw new StartupError( |
| 95 | + throw new StartupError( // eslint-disable-line no-restricted-syntax |
99 | 96 | `Timeout (${timeout}) waiting for ${host}:${port} to be free`); |
100 | 97 | } |
101 | 98 | const error = await new Promise((resolve) => { |
@@ -255,7 +252,7 @@ class NodeInspector { |
255 | 252 | return; |
256 | 253 | } catch (error) { |
257 | 254 | debuglog('connect failed', error); |
258 | | - await setTimeout(1000); |
| 255 | + await pSetTimeout(1000); |
259 | 256 | } |
260 | 257 | } |
261 | 258 | this.stdout.write(' failed to connect, please retry\n'); |
|
0 commit comments