forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: return a number from process.constrainedMemory() constantly
`0` is already a special value returned from `uv_get_constrained_memory` representing unknown or no constraint. Make `process.constrainedMemory()` constantly return a number instead to avoid polymorphic return type. PR-URL: nodejs#52039 Reviewed-By: theanarkh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
- Loading branch information
1 parent
0ed2abb
commit 908f64a
Showing
3 changed files
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const { Worker } = require('worker_threads'); | ||
|
||
const constrainedMemory = process.constrainedMemory(); | ||
if (constrainedMemory !== undefined) { | ||
assert(constrainedMemory > 0); | ||
} | ||
if (!process.env.isWorker) { | ||
process.env.isWorker = true; | ||
new Worker(__filename); | ||
} | ||
assert.strictEqual(typeof constrainedMemory, 'number'); |