GeezerVison is showing github.com — stream: switch to internal `sleep` binding · nodejs/node@58fa2ee
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/streams/fast-utf8-stream.js +1-20Lines changed: 1 addition & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
6 | 6 |
|
7 | 7 | const { |
8 | 8 | ArrayPrototypePush, |
9 | | - AtomicsWait, |
10 | | - Int32Array, |
11 | 9 | MathMax, |
12 | | - Number, |
13 | 10 | SymbolDispose, |
14 | 11 | } = primordials; |
15 | 12 |
|
16 | 13 | const { |
17 | | - constructSharedArrayBuffer, |
| 14 | + sleep, |
18 | 15 | } = require('internal/util'); |
19 | 16 |
|
20 | 17 | const { |
@@ -50,22 +47,6 @@ const { |
50 | 47 | const BUSY_WRITE_TIMEOUT = 100; |
51 | 48 | const kEmptyBuffer = Buffer.allocUnsafe(0); |
52 | 49 |
|
53 | | -const kNil = new Int32Array(constructSharedArrayBuffer(4)); |
54 | | - |
55 | | -function sleep(ms) { |
56 | | - // Also filters out NaN, non-number types, including empty strings, but allows bigints |
57 | | - const valid = ms > 0 && ms < Infinity; |
58 | | - if (valid === false) { |
59 | | - if (typeof ms !== 'number' && typeof ms !== 'bigint') { |
60 | | - throw new ERR_INVALID_ARG_TYPE('ms', ['number', 'bigint'], ms); |
61 | | - } |
62 | | - throw new ERR_INVALID_ARG_VALUE.RangeError('ms', ms, |
63 | | - 'must be a number greater than 0 and less than Infinity'); |
64 | | - } |
65 | | - |
66 | | - AtomicsWait(kNil, 0, 0, Number(ms)); |
67 | | -} |
68 | | - |
69 | 50 | // 16 KB. Don't write more than docker buffer size. |
70 | 51 | // https://github.com/moby/moby/blob/513ec73831269947d38a644c278ce3cac36783b2/daemon/logger/copier.go#L13 |
71 | 52 | const kMaxWrite = 16 * 1024; |
|