Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 23, 2021
1 parent 1f4e70e commit 6e73212
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/streams/duplexify.js
Expand Up @@ -206,15 +206,17 @@ module.exports = function duplexify(body, name) {
function fromAsyncGen(fn) {
let { promise, resolve } = createDeferredPromise();
const ac = new AbortController();
const signal = ac.signal;
const value = fn(async function*() {
while (true) {
const { chunk, done, cb } = await promise;
process.nextTick(cb);
if (done) return;
if (signal.aborted) throw new AbortError();
yield chunk;
({ promise, resolve } = createDeferredPromise());
}
}(), { signal: ac.signal });
}(), { signal });

return {
value,
Expand Down

0 comments on commit 6e73212

Please sign in to comment.