Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58fa2ee

Browse filesBrowse files
aduh95sxa
authored andcommitted
stream: switch to internal sleep binding
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #63611 Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 02f35d6 commit 58fa2ee
Copy full SHA for 58fa2ee

1 file changed

+1-20Lines changed: 1 addition & 20 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/fast-utf8-stream.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/fast-utf8-stream.js
+1-20Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66

77
const {
88
ArrayPrototypePush,
9-
AtomicsWait,
10-
Int32Array,
119
MathMax,
12-
Number,
1310
SymbolDispose,
1411
} = primordials;
1512

1613
const {
17-
constructSharedArrayBuffer,
14+
sleep,
1815
} = require('internal/util');
1916

2017
const {
@@ -50,22 +47,6 @@ const {
5047
const BUSY_WRITE_TIMEOUT = 100;
5148
const kEmptyBuffer = Buffer.allocUnsafe(0);
5249

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-
6950
// 16 KB. Don't write more than docker buffer size.
7051
// https://github.com/moby/moby/blob/513ec73831269947d38a644c278ce3cac36783b2/daemon/logger/copier.go#L13
7152
const kMaxWrite = 16 * 1024;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.