/claim #9810
Fix ZStream.buffer(n) prefetch semantics so it doesn’t run more than n elements ahead.
n > 1, internal queue capacity is adjusted to n - 1 to account for the single in-flight element downstream.n == 1, use a synchronous handoff (ack per element) so the upstream cannot advance beyond one element.sbt "streamsTestsJVM/testOnly zio.stream.ZStreamSpec -- -t buffer"
Includes new regression tests:
buffer(1) does not run more than one element aheadbuffer(2) does not run more than two elements aheadthecafetron-ctrl
@thecafetron-ctrl
ZIO
@ZIO