@nxtedition/lib 23.6.6 → 23.6.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/under-pressure.js +16 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "23.6.6",
3
+ "version": "23.6.7",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/under-pressure.js CHANGED
@@ -69,12 +69,7 @@ export default function (opts = {}) {
69
69
  updateEventLoopUtilization()
70
70
 
71
71
  if (isUnderPressure()) {
72
- onPressure({
73
- eventLoopDelay,
74
- heapUsedBytes,
75
- rssBytes,
76
- eventLoopUtilized,
77
- })
72
+ onPressure(getPressure())
78
73
  }
79
74
 
80
75
  timer.refresh()
@@ -96,22 +91,22 @@ export default function (opts = {}) {
96
91
  return checkMaxEventLoopUtilization && eventLoopUtilized > maxEventLoopUtilization
97
92
  }
98
93
 
94
+ function getPressure() {
95
+ return {
96
+ eventLoopDelay,
97
+ maxEventLoopDelay,
98
+ rssBytes,
99
+ maxRssBytes,
100
+ heapUsedBytes,
101
+ maxHeapUsedBytes,
102
+ eventLoopUtilized,
103
+ maxEventLoopUtilization,
104
+ }
105
+ }
106
+
99
107
  return {
100
- get isUnderPressure() {
101
- return isUnderPressure()
102
- },
103
- get stats() {
104
- return {
105
- eventLoopDelay,
106
- maxEventLoopDelay,
107
- rssBytes,
108
- maxRssBytes,
109
- heapUsedBytes,
110
- maxHeapUsedBytes,
111
- eventLoopUtilized,
112
- maxEventLoopUtilization,
113
- }
114
- },
108
+ isUnderPressure,
109
+ getPressure,
115
110
  [Symbol.dispose]() {
116
111
  clearTimeout(timer)
117
112
  },