GeezerVison is showing github.com — lib: refactored scheduling policy assignment · nodejs/node@94d0a08
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/cluster/master.js +11-10Lines changed: 11 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,16 +37,17 @@ let debugPortOffset = 1; |
37 | 37 | let initialized = false; |
38 | 38 |
|
39 | 39 | // XXX(bnoordhuis) Fold cluster.schedulingPolicy into cluster.settings? |
40 | | -let schedulingPolicy = { |
41 | | - 'none': SCHED_NONE, |
42 | | - 'rr': SCHED_RR |
43 | | -}[process.env.NODE_CLUSTER_SCHED_POLICY]; |
44 | | - |
45 | | -if (schedulingPolicy === undefined) { |
46 | | - // FIXME Round-robin doesn't perform well on Windows right now due to the |
47 | | - // way IOCP is wired up. |
48 | | - schedulingPolicy = (process.platform === 'win32') ? SCHED_NONE : SCHED_RR; |
49 | | -} |
| 40 | +let schedulingPolicy = process.env.NODE_CLUSTER_SCHED_POLICY; |
| 41 | +if (schedulingPolicy === 'rr') |
| 42 | + schedulingPolicy = SCHED_RR; |
| 43 | +else if (schedulingPolicy === 'none') |
| 44 | + schedulingPolicy = SCHED_NONE; |
| 45 | +else if (process.platform === 'win32') { |
| 46 | + // Round-robin doesn't perform well on |
| 47 | + // Windows due to the way IOCP is wired up. |
| 48 | + schedulingPolicy = SCHED_NONE; |
| 49 | +} else |
| 50 | + schedulingPolicy = SCHED_RR; |
50 | 51 |
|
51 | 52 | cluster.schedulingPolicy = schedulingPolicy; |
52 | 53 |
|
|