fix: fix possible non-termination in ingest_drop()
.
#38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where
ingest_drop()
may not terminate.I ran into this issue while adding a way to import drops in earthstar. I'm honestly not sure why the same issue isn't run into in the willow test cases, but I do have a failing test case in a PR to the Earthstar repo.
The issue is that we are pushing chunks into the FIFO and then later here, we are triggering a
for await
loop that will never end because the FIFO has no concept of an EOF or terminating message.Then a little bit further down the code we are awaiting on the promise running that endless loop, so that we never finish.
This gets around the issue by wrapping the FIFO in a generator that will properly exit when we push an
undefined
to it. That way we can indicate the end of the stream.