-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only use os.cpus() and filter out core like physical-cpu-count did #142
Conversation
The problem is with heroku and some CI, the physical-cpu-count linux branch requires a binary and access not provided by these environments.
It will fix #133 |
src/WorkerFarm.js
Outdated
@@ -86,4 +87,13 @@ for (let key in EventEmitter.prototype) { | |||
WorkerFarm.prototype[key] = EventEmitter.prototype[key]; | |||
} | |||
|
|||
function getNumWorkers() { | |||
const cores = os.cpus().filter(function(cpu, index) { | |||
const hasHyperthreading = cpu.model.includes('Intel'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really a good assumption? Do all Intel CPUs have hyperthreading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the else catchall branch of physical-cpu-count.
I don't know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also i’m pretty sure AMD’s newer Ryzen cpus have SMT, which is what Intel calls hyperthreading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a Gist of the aforementioned physical-cpu-count for reference. The Intel check seems to be the last-ditch effort.
Since function getNumWorkers() {
let cores;
try {
cores = require('physical-cpu-count');
} catch (err) {
cores = os.cpus();
}
return cores;
} |
Does it throw on Heroku or returns something else? |
You will still have that warning, but it does not break? |
@reel my bad, I lied! It works! my little heroku app gets built correctly: https://shrouded-ocean-46253.herokuapp.com/ Like you said, warning is still there but it doesn't break. log
|
But, it was crashing before or just writing a msg? As this PR might not be required. |
Crashing! Sent with GitHawk |
src/WorkerFarm.js
Outdated
try { | ||
cores = require('physical-cpu-count'); | ||
} catch (err) { | ||
cores = os.cpus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be os.cpus().length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weekends...
…arcel-bundler#142) * Only use os.cpus() and filter out core like physical-cpu-count did The problem is with heroku and some CI, the physical-cpu-count linux branch requires a binary and access not provided by these environments. * using physical-cpu-count and defaulting to os.cpus() * get the actual length, should be good
Has this been solved? I am trying to create dist folder on heroku and it gives the same message .
|
@sohaibnehal I think 9d319af solves the issue |
) * Only use os.cpus() and filter out core like physical-cpu-count did The problem is with heroku and some CI, the physical-cpu-count linux branch requires a binary and access not provided by these environments. * using physical-cpu-count and defaulting to os.cpus() * get the actual length, should be good
) * Only use os.cpus() and filter out core like physical-cpu-count did The problem is with heroku and some CI, the physical-cpu-count linux branch requires a binary and access not provided by these environments. * using physical-cpu-count and defaulting to os.cpus() * get the actual length, should be good
The problem is with heroku and some CI, the physical-cpu-count linux branch requires a binary and access not provided by these environments.