Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: fix _final and 'prefinish' timing #32780

Closed
wants to merge 3 commits into from

Commits on Apr 15, 2020

  1. stream: fix _final and 'prefinish' timing

    This PR fixes a few different things:
    
    The timing of 'prefinish' depends on whether or not
    _final is defined. In on case the event is emitted
    synchronously with end() and otherwise asynchronously.
    
    _final is currently unecessarily called asynchronously
    which forces implementors to use 'prefinish' as a hack
    to emulate synchronous behaviour. Furthermore, this hack
    is subtly broken due to the above issue.
    
    The stream should not finish if errored or destroyed
    synchronously during the prefinish stage.
    
    Refs: nodejs#31401
    Refs: nodejs#32763 (comment)
    ronag committed Apr 15, 2020
    Copy the full SHA
    be9f726 View commit details
    Browse the repository at this point in the history
  2. fixup: comments

    ronag committed Apr 15, 2020
    Copy the full SHA
    469766e View commit details
    Browse the repository at this point in the history
  3. fixup: missing needFinish

    ronag committed Apr 15, 2020
    Copy the full SHA
    571eb88 View commit details
    Browse the repository at this point in the history