@nxtedition/lib 23.9.16 → 23.9.18
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/app.js +27 -22
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -346,13 +346,15 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
346
346
|
let underPressure
|
|
347
347
|
if (appConfig.underPressure) {
|
|
348
348
|
underPressure = makeUnderPressure(appConfig.underPressure)
|
|
349
|
-
underPressure
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
349
|
+
if (underPressure) {
|
|
350
|
+
underPressure.pressure$.subscribe((pressure) => {
|
|
351
|
+
if (pressure) {
|
|
352
|
+
logger?.warn({ pressure }, 'pressure triggered')
|
|
353
|
+
} else {
|
|
354
|
+
logger?.debug('pressure cleared')
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
}
|
|
356
358
|
}
|
|
357
359
|
|
|
358
360
|
if (appConfig.couchdb || appConfig.couch) {
|
|
@@ -524,23 +526,27 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
524
526
|
rx.map(() => performance.eventLoopUtilization?.()),
|
|
525
527
|
rx.pairwise(),
|
|
526
528
|
rx.map(([elu1, elu2]) => {
|
|
527
|
-
const
|
|
529
|
+
const mem = process.memoryUsage()
|
|
528
530
|
const cpu = process.cpuUsage()
|
|
529
531
|
|
|
530
|
-
|
|
532
|
+
const memory = {
|
|
533
|
+
rss: mem.rss,
|
|
534
|
+
heapTotal: mem.heapTotal,
|
|
535
|
+
heapUsed: mem.heapUsed,
|
|
536
|
+
external: mem.external,
|
|
537
|
+
arrayBuffers: mem.arrayBuffers,
|
|
538
|
+
totalHeapTotal: 0,
|
|
539
|
+
totalHeapUsed: 0,
|
|
540
|
+
totalExternal: 0,
|
|
541
|
+
totalArrayBuffers: 0,
|
|
542
|
+
}
|
|
543
|
+
|
|
531
544
|
if (memoryUsageMap) {
|
|
532
|
-
totalMemory = {
|
|
533
|
-
rss: memory.rss,
|
|
534
|
-
heapTotal: 0,
|
|
535
|
-
heapUsed: 0,
|
|
536
|
-
external: 0,
|
|
537
|
-
arrayBuffers: 0,
|
|
538
|
-
}
|
|
539
545
|
for (const memoryUsage of memoryUsageMap.values()) {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
546
|
+
memory.totalHeapTotal += memoryUsage.heapTotal
|
|
547
|
+
memory.totalHeapUsed += memoryUsage.heapUsed
|
|
548
|
+
memory.totalExternal += memoryUsage.external
|
|
549
|
+
memory.totalArrayBuffers += memoryUsage.arrayBuffers
|
|
544
550
|
}
|
|
545
551
|
}
|
|
546
552
|
|
|
@@ -552,7 +558,6 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
552
558
|
underPressure: underPressure?.isUnderPressure() ? underPressure.getPressure() : null,
|
|
553
559
|
cpu,
|
|
554
560
|
memory,
|
|
555
|
-
totalMemory,
|
|
556
561
|
resourceLimits,
|
|
557
562
|
utilization: performance.eventLoopUtilization?.(elu2, elu1),
|
|
558
563
|
heap: v8.getHeapStatistics(),
|
|
@@ -645,7 +650,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
645
650
|
],
|
|
646
651
|
),
|
|
647
652
|
) ?? rxjs.of([]),
|
|
648
|
-
underPressure?.pressure
|
|
653
|
+
underPressure?.pressure$?.pipe(
|
|
649
654
|
rx.map((pressure) =>
|
|
650
655
|
pressure == null
|
|
651
656
|
? []
|