mscdex / dicer

A very fast streaming multipart parser for node.js
MIT License
186 stars 36 forks source link

unpause after backpressure when all parts have finished #9

Closed ehennum closed 8 years ago

ehennum commented 8 years ago

During stress testing, we found another rare condition where Dicer doesn't finish. When the part writer provides backpressure before any part has finished and the buffered writes either end immediately after a part boundary or after the first hyphen following the last part boundary, Dicer doesn't leave the pause state.

The fix that worked in our stress testing was to unpause by calling the paused callback when input has not finished but there are no parts.

The pull request includes a unit test.

If the pull request is acceptable, could you also cut a new release so we could consume Dicer with the fix.

Thanks for implementing Dicer -- the library is really useful and works well for us.

ehennum commented 8 years ago

I committed the fixes for the issues above to the branch for the pull request.

mscdex commented 8 years ago

One more minor style nit. Otherwise LGTM

ehennum commented 8 years ago

I believe the most recent commit fixes that style gaffe. Good to go?

mscdex commented 8 years ago

Landed in f88ab0bb79. Thanks!