Skip to content

Commit ca4f12c

Browse files
committed
fixup: avoid sync optimization for now
1 parent 4f6cad3 commit ca4f12c

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

lib/internal/streams/operators.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,7 @@ module.exports.map = function map(stream, fn, options) {
5757
try {
5858
reading = true;
5959
while (queue.length && !ret.destroyed) {
60-
let entry = queue.shift();
61-
62-
if (typeof entry.then === 'function') {
63-
entry = await entry;
64-
}
65-
66-
const [err, val] = entry;
60+
const [err, val] = await queue.shift();
6761
if (err) {
6862
ret.destroy(err);
6963
} else if (!ret.push(val)) {
@@ -80,7 +74,7 @@ module.exports.map = function map(stream, fn, options) {
8074

8175
async function wrap (val) {
8276
try {
83-
return [null, await val];
77+
return [null, await fn(val, { signal })];
8478
} catch (err) {
8579
return [err, null];
8680
}
@@ -100,16 +94,7 @@ module.exports.map = function map(stream, fn, options) {
10094
return;
10195
}
10296

103-
try {
104-
val = fn(val, { signal });
105-
if (val && typeof val.then === 'function') {
106-
enqueue(wrap(val));
107-
} else {
108-
enqueue([null, val]);
109-
}
110-
} catch (err) {
111-
enqueue([err, null]);
112-
}
97+
enqueue(wrap(val));
11398
}
11499
}
115100

0 commit comments

Comments
 (0)