@nxtedition/lib 23.6.4 → 23.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/under-pressure.js +10 -6
package/package.json
CHANGED
package/under-pressure.js
CHANGED
|
@@ -21,7 +21,7 @@ export default function (opts = {}) {
|
|
|
21
21
|
const checkMaxRssBytes = maxRssBytes > 0
|
|
22
22
|
const checkMaxEventLoopUtilization = maxEventLoopUtilization > 0
|
|
23
23
|
|
|
24
|
-
let
|
|
24
|
+
let heapUsedBytes = 0
|
|
25
25
|
let rssBytes = 0
|
|
26
26
|
let eventLoopDelay = 0
|
|
27
27
|
let elu
|
|
@@ -68,19 +68,19 @@ export default function (opts = {}) {
|
|
|
68
68
|
|
|
69
69
|
function updateMemoryUsage() {
|
|
70
70
|
const mem = process.memoryUsage()
|
|
71
|
-
|
|
71
|
+
heapUsedBytes = mem.heapUsed
|
|
72
72
|
rssBytes = mem.rss
|
|
73
73
|
updateEventLoopDelay()
|
|
74
74
|
updateEventLoopUtilization()
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
|
-
isUnderPressure() {
|
|
78
|
+
get isUnderPressure() {
|
|
79
79
|
if (checkMaxEventLoopDelay && eventLoopDelay > maxEventLoopDelay) {
|
|
80
80
|
return true
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (checkMaxHeapUsedBytes &&
|
|
83
|
+
if (checkMaxHeapUsedBytes && heapUsedBytes > maxHeapUsedBytes) {
|
|
84
84
|
return true
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -90,12 +90,16 @@ export default function (opts = {}) {
|
|
|
90
90
|
|
|
91
91
|
return checkMaxEventLoopUtilization && eventLoopUtilized > maxEventLoopUtilization
|
|
92
92
|
},
|
|
93
|
-
|
|
93
|
+
get stats() {
|
|
94
94
|
return {
|
|
95
95
|
eventLoopDelay,
|
|
96
|
+
maxEventLoopDelay,
|
|
96
97
|
rssBytes,
|
|
97
|
-
|
|
98
|
+
maxRssBytes,
|
|
99
|
+
heapUsedBytes,
|
|
100
|
+
maxHeapUsedBytes,
|
|
98
101
|
eventLoopUtilized,
|
|
102
|
+
maxEventLoopUtilization,
|
|
99
103
|
}
|
|
100
104
|
},
|
|
101
105
|
[Symbol.dispose]() {
|