| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
lint-js rule check error is triggered :)
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, my bad. Done 👍
Sorry, something went wrong.
|
@nodejs/cluster |
Sorry, something went wrong.
|
I'm really rather lukewarm when it comes to changes like this one. I might be biased because I wrote the current code but the new code is arguably less readable than the code it replaces. |
Sorry, something went wrong.
|
@bnoordhuis is it specific to destructuring or the naming. Just wanted to know the cause 😄 |
Sorry, something went wrong.
|
The destructuring. It's not that it's incredibly complex or difficult to follow, just harder to parse than the current code (IMO.) |
Sorry, something went wrong.
|
@bnoordhuis what should be the correct approach then according to you, because previously we are pulling the scheduling policy straight out from the hash which is not implying anything in general. 🤔 |
Sorry, something went wrong.
|
Well, if you want to make an improvement, how about this? let schedulingPolicy = process.env.NODE_CLUSTER_SCHED_POLICY;
if (schedulingPolicy === 'rr')
schedulingPolicy = SCHED_RR;
else if (schedulingPolicy === 'none')
schedulingPolicy = SCHED_NONE;
else if (process.platform === 'win32')
// Round-robin doesn't perform well on Windows due to the way IOCP is wired up.
schedulingPolicy = SCHED_NONE;
else
schedulingPolicy = SCHED_RR;That at least protects schedulingPolicy from jokers setting NODE_CLUSTER_SCHED_POLICY to __proto__ , constructor, etc. It's a marginal improvement but marginal improvements are improvements too. :-) |
Sorry, something went wrong.
In previous implementation it was clubbed into declaration of scheduling policies and fetching the schedulingPolicy. Now they are separate variables, so that in future if one want to add new scheduling policy. It is much simpler and not obsfucated.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Sorry, something went wrong.
In previous implementation it was clubbed into declaration of scheduling policies and fetching the schedulingPolicy. Now they are separate variables, so that in future if one want to add new scheduling policy. It is much simpler and not obsfucated. PR-URL: #32663 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
In previous implementation it was clubbed into declaration of scheduling policies and fetching the schedulingPolicy. Now they are separate variables, so that in future if one want to add new scheduling policy. It is much simpler and not obsfucated. PR-URL: #32663 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
In previous implementation it was clubbed into declaration of scheduling policies and fetching the schedulingPolicy. Now they are separate variables, so that in future if one want to add new scheduling policy. It is much simpler and not obsfucated. PR-URL: #32663 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
| Back | FazBrowse Home | New Git URL |
In previous implementation it was clubbed into declaration of scheduling
policies and fetching the schedulingPolicy. Now they are separate
variables, so that in future if one want to add new scheduling policy.
It is much simpler and not obsfucated.
Checklist