Limit threads by eviefp · Pull Request #127 · purescript/psc-package (original) (raw)

This is more of a "is this what you had in mind", I'm totally open to feedback.

I added a --threads N option for all commands that (eventually) hit a mapConcurrently or a forConcurrently_. I did it by adding a Maybe Int parameter down the call stack (not sure if it's worth it refactoring all of the functions to some ReaderT env IO; probably not with this PR but I could take that on if it would get accepted).

A value of Nothing means use old behaviour, otherwise use the method suggested by @kritzcreek's link in #126.

I would also like to keep the changes to the import because I like them arranged nicely, but I'm totally fine reverting that chunk if you want me to.

This has been tested on Appveyor on our project and fixed our issues. We have only tested with --threads 1 so far and that works (but is obviously a bit slow).