@nxtedition/lib 21.0.4 → 21.0.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.
Files changed (2) hide show
  1. package/app.js +6 -6
  2. 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) => ({
@@ -464,10 +468,6 @@ export function makeApp(appConfig, onTerminate) {
464
468
  rx.map(() => performance.eventLoopUtilization?.()),
465
469
  rx.pairwise(),
466
470
  rx.map(([elu1, elu2]) => {
467
- const memory = process.memoryUsage()
468
-
469
- memoryUsageBC.postMessage({ data: memory, id: threadId })
470
-
471
471
  let totalMemory
472
472
  if (memoryUsageMap) {
473
473
  totalMemory = {
@@ -491,7 +491,7 @@ export function makeApp(appConfig, onTerminate) {
491
491
  couch: couch?.stats,
492
492
  lag: toobusy?.lag(),
493
493
  version: process.version,
494
- memory,
494
+ memory: process.memoryUsage(),
495
495
  totalMemory,
496
496
  utilization: performance.eventLoopUtilization?.(elu2, elu1),
497
497
  heap: v8.getHeapStatistics(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "21.0.4",
3
+ "version": "21.0.5",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",