-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
cluster: add schedulingPolicy to settings #41731
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
base: main
Are you sure you want to change the base?
Conversation
schedulingPolicy = cluster.schedulingPolicy; // Freeze policy. | ||
assert(schedulingPolicy === SCHED_NONE || schedulingPolicy === SCHED_RR, | ||
`Bad cluster.schedulingPolicy: ${schedulingPolicy}`); | ||
schedulingPolicy = SCHEDULE_POLICY_NAME_MAP.get(cluster.schedulingPolicy); // Freeze policy. |
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 we be keeping the assert()
to ensure settings.schedulingPolicy
maps to a supported value in SCHEDULE_POLICY_NAME_MAP
?
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.
As I understand, it should be handled via SafeMap above:
https://github.com/yashLadha/node/blob/9027b55935784c5e40ac54db5919895ad1636f16/lib/internal/cluster/primary.js#L47-L49
so the value of settings.schedulingPolicy
can be only supported in SCHEDULE_POLICY_NAME_MAP
. Hence the assert
is redundant in this particular case.
} else | ||
schedulingPolicy = SCHED_RR; | ||
|
||
cluster.schedulingPolicy = schedulingPolicy; |
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.
We need to keep this (cluster.schedulingPolicy
) and consider its value to avoid breaking things.
Added `schedulingPolicy` option to settings so that the cluster owners can schedule the handler explicitly as well. They can use the name either `rr` or `none` for setting up the schedulingPolicy for setting up the primary process.
1549ad8
to
9027b55
Compare
That's adding an option, so it's semver-minor, right? We'd need to add an entry in the |
I think it makes more sense to have Additionally, I think the changes here can be simplified by leaving the original top-level initialization of |
Added
schedulingPolicy
option to settings so that the cluster ownerscan schedule the handler explicitly as well. They can use the name
either
rr
ornone
for setting up the schedulingPolicy ofthe primary process.