flex icon indicating copy to clipboard operation
flex copied to clipboard

Change buffer method from list to queue

Open adworse opened this issue 3 years ago • 0 comments

First of all, thank you so much for a nice example of great problem-solving.

I'd like to propose a small fix for a really rare occasion.

Currently, an Elixir list is used as a buffer for excessive chunks in Flex.Stream.Worker, creating LIFO buffer. On some rare conditions, namely:

  • Internet connection is fast enough,
  • stream consumption on the contrary is slow enough

this leads to chunks coming up in the messed-up order.

Usually, this comes unnoticed except in the case of non-text files, like for example gzipped streams. In this case, the resulting stream will be unprocessable.

This PR changes buffering to Erlang's :queue, keeping the internal API as it was. It fixes a bug with binary file streaming in the otherwise great tool.

adworse avatar May 17 '22 20:05 adworse