streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Ahead streams might dispatch too many workers doing nothing

Open harendra-kumar opened this issue 3 years ago • 1 comments

When we execute this:

> stream1 = Stream.sequence $ Stream.fromList [delay 2, delay 2, delay 2]
> stream2 = Stream.sequence $ Stream.replicate 5 (delay 1)
> Stream.fold Fold.toList $ Async.concatWith (Async.stopWhen Async.AnyStops . Async.inspectMode . Async.ordered) $ Stream.fromList [stream1, stream2]

Sometimes it leads to dispatching too many workers, ideally it should not dispatch more than a few. See also #1921 .

harendra-kumar avatar Oct 09 '22 18:10 harendra-kumar

This seems to happen when we add some prints or traces in the code, may be due to some race condition.

harendra-kumar avatar Oct 09 '22 18:10 harendra-kumar