When a Producer is stopped and started again, it does not yield elements until all child iterators (or more precisely the listeners on those iterators (the "drivers")) have ended due to the total detachment. This change was made while removing $this references within methods that touched the $racetrack drivers [to prevent a massive memory leak, see #4] — now, _attachawaits the previous drivers directly as opposed to pushing that responsibility onto the next driver. This saves a reference to $this and some Awaitable acrobatics, but sadly the titled behavior is the result.
The HTTP section of the README example code is a perfect example of this happening:
// Merge stream of requests from ports 80 and 8080
$http_firehose = Producer::merge(Vector{ connection_factory(80), new connection_factory(8080) });
foreach(clone $http_firehose await as $connection) {
await $connection->write('No, _you_ deal with this');
break;
}
foreach(clone $http_firehose await as $maybe_connection) {
$connection = await $maybe_connection;
// this isn't reached until the port that wasn't requested in the first
// `foreach` is hit by a request
}
When a Producer is stopped and started again, it does not yield elements until all child iterators (or more precisely the listeners on those iterators (the "drivers")) have ended due to the total detachment. This change was made while removing
$this
references within methods that touched the$racetrack
drivers [to prevent a massive memory leak, see #4] — now,_attach
await
s the previous drivers directly as opposed to pushing that responsibility onto the next driver. This saves a reference to$this
and someAwaitable
acrobatics, but sadly the titled behavior is the result.The HTTP section of the README example code is a perfect example of this happening: