Commit bb3e381
committed
Fix race between two 'finish' events
When unzipping the file that is being downloaded, there are two streams
whose `finish` event are eagerly awaited: the stream that unpacks the
last entry of the .zip file and the stream that processes the .zip file
itself.
When this code was originally written, the stream that extracted the
.zip entry always sent its `finish` event before the stream that
processed the enclosing .zip file.
However, with our upgrade to node.js v20.x, this seems no longer to be
true. As a consequence, the code that wants to verify that all expected
bytes were extracted now _sometimes_ runs too early, and shouts
"failure" just before the code that extracts the bytes runs and all
files are written correctly.
Let's work around it by ensuring that both `finish` events were received
before determining success or failure.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 791f223 commit bb3e381
1 file changed
+16
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| |||
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| 101 | + | |
91 | 102 | | |
92 | 103 | | |
93 | 104 | | |
| 105 | + | |
94 | 106 | | |
95 | 107 | | |
| 108 | + | |
| 109 | + | |
96 | 110 | | |
97 | 111 | | |
98 | 112 | | |
99 | 113 | | |
100 | 114 | | |
101 | 115 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 116 | + | |
| 117 | + | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
| |||
0 commit comments