Use availableParallelism, not cpus().length when determining max workers - #569
Use availableParallelism, not cpus().length when determining max workers#569bdurette wants to merge 3 commits into
Conversation
|
Thanks Brandon, good idea to use One thought: I see |
I'm not opposed to that. Whatever you prefer is fine. I had implemented that in my first commit and then backed that out, because it added some complexity -- especially if I needed to test that fallback. Take a look. If that looks good to you, we can roll back that latest commit that takes out the fallback easy enough. |
|
Ah, I see your first commit. That is indeed what I mean, though I think I would write it like I indeed prefer keeping the backward compatibility, but I'm OK with not adding tests to validate that this fallback works (that would require mocking |
Resolves #568
The
os.cpus()documentation explicitly recommends against using that function for determining the resources available to your process. This is, among other things, because it is not container-aware. Instead, we useavailableParallelismwhen running outside the browser, which is the recommended alternative.