-
-
Notifications
You must be signed in to change notification settings - Fork 34.8k
Closed
Description
Continuation of #31222
Further issues with the example. See comment:
async function pump(iterable, writable) {
for await (const chunk of iterable) {
// Handle backpressure on write().
if (!writable.write(chunk)) {
if (writable.destroyed) return;
await once(writable, 'drain'); // BUG? This will never complete if writable is destroyed with `.destroy()`.
}
}
writable.end();
}The problem here is that it assumes that either 'drain' or 'error' will be emitted, however this is not always the case.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels