@platformatic/runtime 3.32.0-alpha.1 → 3.32.0

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/lib/runtime.js CHANGED
@@ -69,6 +69,8 @@ import {
69
69
 
70
70
  const kWorkerFile = join(import.meta.dirname, 'worker/main.js')
71
71
  const kInspectorOptions = Symbol('plt.runtime.worker.inspectorOptions')
72
+ const kHeapCheckCounter = Symbol('plt.runtime.worker.heapCheckCounter')
73
+ const kLastHeapStats = Symbol('plt.runtime.worker.lastHeapStats')
72
74
 
73
75
  const MAX_LISTENERS_COUNT = 100
74
76
 
@@ -1472,7 +1474,16 @@ export class Runtime extends EventEmitter {
1472
1474
  return { elu: elu.utilization, currentELU }
1473
1475
  }
1474
1476
 
1475
- const { used_heap_size: heapUsed, total_heap_size: heapTotal } = await worker.getHeapStatistics()
1477
+ // Only check heap statistics every 60 health checks (once per minute)
1478
+ const counter = (worker[kHeapCheckCounter] ?? 0) + 1
1479
+ worker[kHeapCheckCounter] = counter >= 60 ? 0 : counter
1480
+
1481
+ if (counter >= 60 || !worker[kLastHeapStats]) {
1482
+ const { used_heap_size: heapUsed, total_heap_size: heapTotal } = await worker.getHeapStatistics()
1483
+ worker[kLastHeapStats] = { heapUsed, heapTotal }
1484
+ }
1485
+
1486
+ const { heapUsed, heapTotal } = worker[kLastHeapStats]
1476
1487
  return { elu: elu.utilization, heapUsed, heapTotal, currentELU }
1477
1488
  }
1478
1489
 
@@ -13,7 +13,7 @@ import { join, resolve } from 'node:path'
13
13
  import { pathToFileURL } from 'node:url'
14
14
  import { threadId, workerData } from 'node:worker_threads'
15
15
  import pino from 'pino'
16
- import { fetch } from 'undici'
16
+ import { install as installUndiciGlobals } from 'undici'
17
17
  import { Controller } from './controller.js'
18
18
  import { setDispatcher } from './interceptors.js'
19
19
  import { setupITC } from './itc.js'
@@ -137,7 +137,7 @@ async function setupCompileCache (runtimeConfig, applicationConfig, logger) {
137
137
  }
138
138
 
139
139
  async function main () {
140
- globalThis.fetch = fetch
140
+ installUndiciGlobals(globalThis)
141
141
  globalThis[kId] = threadId
142
142
  globalThis.platformatic = Object.assign(globalThis.platformatic ?? {}, {
143
143
  logger: createLogger(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "3.32.0-alpha.1",
3
+ "version": "3.32.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -35,14 +35,14 @@
35
35
  "typescript": "^5.5.4",
36
36
  "undici-oidc-interceptor": "^0.5.0",
37
37
  "why-is-node-running": "^2.2.2",
38
- "@platformatic/composer": "3.32.0-alpha.1",
39
- "@platformatic/db": "3.32.0-alpha.1",
40
- "@platformatic/gateway": "3.32.0-alpha.1",
41
- "@platformatic/node": "3.32.0-alpha.1",
42
- "@platformatic/service": "3.32.0-alpha.1",
43
- "@platformatic/sql-graphql": "3.32.0-alpha.1",
44
- "@platformatic/sql-mapper": "3.32.0-alpha.1",
45
- "@platformatic/wattpm-pprof-capture": "3.32.0-alpha.1"
38
+ "@platformatic/composer": "3.32.0",
39
+ "@platformatic/db": "3.32.0",
40
+ "@platformatic/gateway": "3.32.0",
41
+ "@platformatic/node": "3.32.0",
42
+ "@platformatic/sql-graphql": "3.32.0",
43
+ "@platformatic/service": "3.32.0",
44
+ "@platformatic/sql-mapper": "3.32.0",
45
+ "@platformatic/wattpm-pprof-capture": "3.32.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@fastify/accepts": "^5.0.0",
@@ -71,12 +71,12 @@
71
71
  "undici": "^7.0.0",
72
72
  "undici-thread-interceptor": "^1.0.0",
73
73
  "ws": "^8.16.0",
74
- "@platformatic/basic": "3.32.0-alpha.1",
75
- "@platformatic/foundation": "3.32.0-alpha.1",
76
- "@platformatic/generators": "3.32.0-alpha.1",
77
- "@platformatic/itc": "3.32.0-alpha.1",
78
- "@platformatic/metrics": "3.32.0-alpha.1",
79
- "@platformatic/telemetry": "3.32.0-alpha.1"
74
+ "@platformatic/basic": "3.32.0",
75
+ "@platformatic/foundation": "3.32.0",
76
+ "@platformatic/generators": "3.32.0",
77
+ "@platformatic/itc": "3.32.0",
78
+ "@platformatic/metrics": "3.32.0",
79
+ "@platformatic/telemetry": "3.32.0"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.32.0-alpha.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.32.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Runtime Config",
5
5
  "type": "object",