Commit ea87809
committed
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.
Refs: #31401
Refs: #32763 (comment)
PR-URL: #32780
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>1 parent d08bd41 commit ea87809Copy full SHA for ea87809
File tree
Expand file treeCollapse file tree
6 files changed
+88
-23
lines changedOpen diff view settings
Filter options
- lib
- internal/http2
- test/parallel
Expand file treeCollapse file tree
6 files changed
+88
-23
lines changedOpen diff view settings
Collapse file
+4-4Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
99 | 99 | |
100 | 100 | |
101 | 101 | |
102 | | - |
103 | | - |
104 | | - |
105 | | - |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
106 | 106 | |
107 | 107 | |
108 | 108 | |
|
Collapse file
+15-9Lines changed: 15 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
635 | 635 | |
636 | 636 | |
637 | 637 | |
| 638 | + |
| 639 | + |
638 | 640 | |
639 | 641 | |
640 | 642 | |
641 | | - |
642 | | - |
| 643 | + |
| 644 | + |
643 | 645 | |
644 | 646 | |
645 | | - |
| 647 | + |
| 648 | + |
| 649 | + |
| 650 | + |
| 651 | + |
646 | 652 | |
647 | 653 | |
| 654 | + |
648 | 655 | |
649 | 656 | |
650 | 657 | |
651 | 658 | |
652 | 659 | |
653 | | - |
654 | 660 | |
655 | | - |
| 661 | + |
656 | 662 | |
657 | 663 | |
658 | 664 | |
| ||
661 | 667 | |
662 | 668 | |
663 | 669 | |
664 | | - |
665 | | - |
| 670 | + |
666 | 671 | |
667 | | - |
| 672 | + |
668 | 673 | |
669 | 674 | |
670 | 675 | |
| ||
673 | 678 | |
674 | 679 | |
675 | 680 | |
676 | | - |
677 | 681 | |
678 | 682 | |
679 | 683 | |
680 | 684 | |
681 | 685 | |
682 | 686 | |
683 | 687 | |
| 688 | + |
| 689 | + |
684 | 690 | |
685 | 691 | |
686 | 692 | |
|
Collapse file
+6-3Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1710 | 1710 | |
1711 | 1711 | |
1712 | 1712 | |
| 1713 | + |
| 1714 | + |
| 1715 | + |
| 1716 | + |
| 1717 | + |
| 1718 | + |
1713 | 1719 | |
1714 | 1720 | |
1715 | | - |
1716 | | - |
1717 | | - |
1718 | 1721 | |
1719 | 1722 | |
1720 | 1723 | |
|
Collapse file
test/parallel/test-stream-transform-final-sync.js
Copy file name to clipboardExpand all lines: test/parallel/test-stream-transform-final-sync.js+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | | - |
| 85 | + |
86 | 86 | |
87 | 87 | |
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | | - |
| 93 | + |
94 | 94 | |
95 | 95 | |
96 | 96 | |
| ||
106 | 106 | |
107 | 107 | |
108 | 108 | |
109 | | - |
| 109 | + |
110 | 110 | |
Collapse file
test/parallel/test-stream-transform-final.js
Copy file name to clipboardExpand all lines: test/parallel/test-stream-transform-final.js+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | | - |
| 87 | + |
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | | - |
| 95 | + |
96 | 96 | |
97 | 97 | |
98 | 98 | |
| ||
108 | 108 | |
109 | 109 | |
110 | 110 | |
111 | | - |
| 111 | + |
112 | 112 | |
Collapse file
test/parallel/test-stream-writable-finished.js
Copy file name to clipboardExpand all lines: test/parallel/test-stream-writable-finished.js+57-1Lines changed: 57 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | | - |
| 33 | + |
34 | 34 | |
35 | 35 | |
36 | 36 | |
| ||
41 | 41 | |
42 | 42 | |
43 | 43 | |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
0 commit comments