Concurrency Issue in Open-Source Project Causing Script to Hang
I'm running into a concurrency issue (potentially a bug?) that's been hard to create a small reproduction for - was wondering if anyone might have insight (my project is also open-source so anyone can run it).
https://github.com/aniravi24/typefusion/blob/main/packages/typefusion/src/typefusion.ts#L83
Here, you can see that I call
- When there are no errors, the program completes as normal.
- When concurrency is set to 1 and there is an error, it terminates the effect and throws the error as expected.
- When concurrency is unbounded (or seemingly anything higher than 1 or 2), the program hangs and doesn't proceed or complete. I only expected one error in my test scenario, so I added
https://github.com/aniravi24/typefusion/blob/main/packages/typefusion/src/typefusion.ts#L83
Here, you can see that I call
runTypefusionScript inside a forEach with concurrency: inherit (not setting concurrency anywhere else, so it's unbounded here). - When there are no errors, the program completes as normal.
- When concurrency is set to 1 and there is an error, it terminates the effect and throws the error as expected.
- When concurrency is unbounded (or seemingly anything higher than 1 or 2), the program hangs and doesn't proceed or complete. I only expected one error in my test scenario, so I added
.pipe(Effect.tapErrorCause(Effect.logError)) after my call to runTypefusionScript and saw the error print as expected. However, the error is not causing the Effect to terminate, it just keeps it hanging.