Fork me on GitHub

the docstring for pipeline-async states: "By default, the to channel will be closed when the from channel closes, but can be determined by the close? parameter." Do we have to worry about race conditions here and handle that manually? Like if the from channel closes causing the to channel to close before all the async transformations are finished? Or is that not a concern here?


this should be easy to test with some timeout reads, but I’d assume that what it would actually do is wait until from gives it a nil (meaning channel is closed and buffer drained) and then only close the to when all puts resulting via processing from have completed (and once again, the consumer of to wouldn’t see the close until the buffer is drained)


this is the implementation function pipeline-async invokes but I can’t tell for sure from reading the code if the issue you describe holds


thanks ya I did a few tests and there didn't seem to be any race conditions, but that doesn't mean it can't happen. I too tried quickly reading through that code and wasn't 100% sure if it could still happen. I guess I'll have to take the time to read it more thoroughly


there are ways to make race conditions more likely - randomized delay times, running thousands of iterations and verifying if any of them raced


this code create N channels and pass list to each channel linearly to remove multipliers


the code works fine for example till 10000 odds [11:02] when i tried to increase more for example 100000 it's broken [11:02] anybody can help in this?


the exception you only pasted the middle of is a stackoverflow exception


because you are building up a bunch of filters, and every layer of filter (every layer of lazy seq) adds another stack frame when you go to realize it