Skip to content

stream: fix timing relative to promises

Workaround for Node "bug". If the stream is destroyed in same tick as it is created, then a user who is waiting for a promise (i.e micro tick) for installing a 'error' listener will never get a chance and will always encounter an unhandled exception.

  • tick => process.nextTick(fn)
  • micro tick => queueMicrotask(fn)

Refs: https://github.com/nodejs/undici/pull/2497

Merge request reports

Loading