Skip to content

Split node: avoid duplicate done call for buffer split#4000

Merged
knolleary merged 1 commit intomasterfrom
fix-split-stream
Jan 23, 2023
Merged

Split node: avoid duplicate done call for buffer split#4000
knolleary merged 1 commit intomasterfrom
fix-split-stream

Conversation

@knolleary
Copy link
Member

Fixes #3982

When splitting buffers in a stream, the node stores any 'left-over' bits following the split to be joined with the next message in the stream. It stored the done event until that left-over bit was made whole.

However, if there were no left-over bits (length === 0), it was storing done for later and calling done.

The fix is to not store the done for later if there is no left-over bit.

But, this does also raise a question of a difference in behaviour between string and buffer modes. I think for String streams, it always calls done after splitting, regardless of any left-over bits... whereas for Buffer streams, as described above, it waits until left-overs are handled.

This could do with tidying up, but needs more investigation and test cases to properly figure out the 'expected' behaviour.

@coveralls
Copy link

Coverage Status

Coverage: 68.233% (+0.002%) from 68.231% when pulling 74794fe on fix-split-stream into 4d202a7 on master.

@knolleary knolleary merged commit 7dbbafe into master Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent done behavior in Split node when streaming

2 participants