@nxtedition/lib 21.0.4 → 21.0.6
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 +6 -5
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -446,11 +446,15 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
446
446
|
let memoryUsageMap
|
|
447
447
|
if (isMainThread) {
|
|
448
448
|
memoryUsageMap = new Map()
|
|
449
|
-
memoryUsageBC.onmessage = ({ data, id }) => {
|
|
449
|
+
memoryUsageBC.onmessage = ({ data: { data, id } }) => {
|
|
450
450
|
memoryUsageMap.set(id, data)
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
+
setInterval(() => {
|
|
455
|
+
memoryUsageBC.postMessage({ data: process.memoryUsage(), id: serviceWorkerId })
|
|
456
|
+
}, 1e3).unref()
|
|
457
|
+
|
|
454
458
|
const startTime = Date.now()
|
|
455
459
|
stats$ = stats$.pipe(
|
|
456
460
|
rx.map((x) => ({
|
|
@@ -466,19 +470,16 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
466
470
|
rx.map(([elu1, elu2]) => {
|
|
467
471
|
const memory = process.memoryUsage()
|
|
468
472
|
|
|
469
|
-
memoryUsageBC.postMessage({ data: memory, id: threadId })
|
|
470
|
-
|
|
471
473
|
let totalMemory
|
|
472
474
|
if (memoryUsageMap) {
|
|
473
475
|
totalMemory = {
|
|
474
|
-
rss:
|
|
476
|
+
rss: memory.rss,
|
|
475
477
|
heapTotal: 0,
|
|
476
478
|
heapUsed: 0,
|
|
477
479
|
external: 0,
|
|
478
480
|
arrayBuffers: 0,
|
|
479
481
|
}
|
|
480
482
|
for (const memoryUsage of memoryUsageMap.values()) {
|
|
481
|
-
totalMemory.rss += memoryUsage.rss
|
|
482
483
|
totalMemory.heapTotal += memoryUsage.heapTotal
|
|
483
484
|
totalMemory.heapUsed += memoryUsage.heapUsed
|
|
484
485
|
totalMemory.external += memoryUsage.external
|