@platformatic/runtime 3.23.0 → 3.24.0-alpha0

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/config.d.ts CHANGED
@@ -155,10 +155,6 @@ export type PlatformaticRuntimeConfig = {
155
155
  server?: {
156
156
  hostname?: string;
157
157
  port?: number | string;
158
- /**
159
- * The maximum length of the queue of pending connections
160
- */
161
- backlog?: number;
162
158
  http2?: boolean;
163
159
  https?: {
164
160
  allowHTTP1?: boolean;
package/lib/config.js CHANGED
@@ -12,7 +12,6 @@ import {
12
12
  import { readdir, readFile } from 'node:fs/promises'
13
13
  import { createRequire } from 'node:module'
14
14
  import { isAbsolute, join, resolve as resolvePath } from 'node:path'
15
-
16
15
  import {
17
16
  InspectAndInspectBrkError,
18
17
  InspectorHostError,
@@ -46,7 +45,7 @@ function raiseInvalidWorkersError (location, received, hint) {
46
45
  throw new InvalidArgumentError(`${location} workers must be a positive integer; received "${received}"${extra}`)
47
46
  }
48
47
 
49
- function parseWorkers (config, prefix, defaultWorkers = { static: 1, dynamic: false }) {
48
+ function parseWorkers (config, prefix, defaultWorkers = 1) {
50
49
  if (typeof config.workers !== 'undefined') {
51
50
  // Number
52
51
  if (typeof config.workers !== 'object') {
@@ -76,26 +75,9 @@ function parseWorkers (config, prefix, defaultWorkers = { static: 1, dynamic: fa
76
75
  }
77
76
  }
78
77
  }
78
+ // No value, inherit from runtime
79
79
  } else {
80
- config.workers = {}
81
- }
82
-
83
- // Fill missing values from defaults
84
- for (const key of ['minimum', 'maximum', 'static', 'dynamic']) {
85
- if (typeof config.workers[key] === 'undefined' && typeof defaultWorkers[key] !== 'undefined') {
86
- config.workers[key] = defaultWorkers[key]
87
- }
88
- }
89
-
90
- // Additional validations
91
- if (config.workers.maximum < config.workers.minimum) {
92
- const t = config.workers.minimum
93
- config.workers.minimum = config.workers.maximum
94
- config.workers.maximum = t
95
- }
96
-
97
- if (typeof config.workers.static === 'undefined') {
98
- config.workers.static = config.workers.minimum
80
+ config.workers = { static: defaultWorkers }
99
81
  }
100
82
  }
101
83
 
@@ -289,10 +271,10 @@ export async function transform (config, _, context) {
289
271
  // TODO: Remove in the next major version
290
272
  if (config.verticalScaler) {
291
273
  config.workers ??= {}
292
- config.workers.total ??= config.verticalScaler.maxTotalWorkers
293
274
  config.workers.dynamic ??= config.verticalScaler.enabled
294
- config.workers.minimum ??= config.verticalScaler.minWorkers ?? 1
295
- config.workers.maximum ??= config.verticalScaler.maxWorkers ?? config.verticalScaler.maxTotalWorkers ?? 1
275
+ config.workers.minimum ??= config.verticalScaler.minWorkers
276
+ config.workers.maximum ??= config.verticalScaler.maxWorkers
277
+ config.workers.total ??= config.verticalScaler.maxTotalWorkers
296
278
  config.workers.maxMemory ??= config.verticalScaler.maxTotalMemory
297
279
 
298
280
  if (typeof config.workers.cooldown === 'undefined' && typeof config.verticalScaler.cooldownSec === 'number') {
@@ -348,8 +330,8 @@ export async function transform (config, _, context) {
348
330
  let hasValidEntrypoint = false
349
331
 
350
332
  // Root-level workers
351
- parseWorkers(config, 'Runtime', { static: 1, dynamic: false })
352
- const defaultWorkers = config.workers
333
+ parseWorkers(config, 'Runtime')
334
+ const defaultWorkers = config.workers.static
353
335
 
354
336
  for (let i = 0; i < applications.length; ++i) {
355
337
  const application = await prepareApplication(config, applications[i], defaultWorkers)
@@ -104,7 +104,7 @@ export async function managementApiPlugin (app, opts) {
104
104
  }
105
105
 
106
106
  for (let i = 0; i < applications.length; i++) {
107
- applications[i] = await prepareApplication(config, applications[i], config.workers)
107
+ applications[i] = await prepareApplication(config, applications[i])
108
108
  }
109
109
 
110
110
  const created = await runtime.addApplications(applications, request.query.start !== 'false')
package/lib/runtime.js CHANGED
@@ -450,7 +450,8 @@ export class Runtime extends EventEmitter {
450
450
  this.logger.warn(
451
451
  `"${application.id}" is set as the entrypoint, but reusePort is not available in your OS; setting workers to 1 instead of ${workers.static}`
452
452
  )
453
- application.workers = { dynamic: false, static: 1 }
453
+ workers.static = 1
454
+ workers.minimum = 1
454
455
  }
455
456
 
456
457
  this.#applications.set(application.id, application)
@@ -1579,8 +1580,8 @@ export class Runtime extends EventEmitter {
1579
1580
  worker[kITC].on('event', ({ event, payload }) => {
1580
1581
  event = `application:worker:event:${event}`
1581
1582
 
1582
- this.emit(event, ...payload, workerId, applicationId, index)
1583
- this.logger.trace({ event, payload, id: workerId, application: applicationId, worker: index }, 'Runtime event')
1583
+ this.emit(event, ...payload)
1584
+ this.logger.trace({ event, payload }, 'Runtime event')
1584
1585
  })
1585
1586
 
1586
1587
  worker[kITC].on('request:restart', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "3.23.0",
3
+ "version": "3.24.0-alpha0",
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.23.0",
39
- "@platformatic/db": "3.23.0",
40
- "@platformatic/gateway": "3.23.0",
41
- "@platformatic/node": "3.23.0",
42
- "@platformatic/service": "3.23.0",
43
- "@platformatic/sql-mapper": "3.23.0",
44
- "@platformatic/sql-graphql": "3.23.0",
45
- "@platformatic/wattpm-pprof-capture": "3.23.0"
38
+ "@platformatic/composer": "3.24.0-alpha0",
39
+ "@platformatic/gateway": "3.24.0-alpha0",
40
+ "@platformatic/db": "3.24.0-alpha0",
41
+ "@platformatic/sql-graphql": "3.24.0-alpha0",
42
+ "@platformatic/service": "3.24.0-alpha0",
43
+ "@platformatic/sql-mapper": "3.24.0-alpha0",
44
+ "@platformatic/wattpm-pprof-capture": "3.24.0-alpha0",
45
+ "@platformatic/node": "3.24.0-alpha0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@fastify/accepts": "^5.0.0",
@@ -64,19 +64,19 @@
64
64
  "minimist": "^1.2.8",
65
65
  "pino": "^9.9.0",
66
66
  "pino-pretty": "^13.0.0",
67
- "prom-client": "^15.1.2",
67
+ "@platformatic/prom-client": "^1.0.0",
68
68
  "semgrator": "^0.3.0",
69
69
  "sonic-boom": "^4.2.0",
70
70
  "systeminformation": "^5.27.11",
71
71
  "undici": "^7.0.0",
72
72
  "undici-thread-interceptor": "^0.15.0",
73
73
  "ws": "^8.16.0",
74
- "@platformatic/basic": "3.23.0",
75
- "@platformatic/foundation": "3.23.0",
76
- "@platformatic/generators": "3.23.0",
77
- "@platformatic/metrics": "3.23.0",
78
- "@platformatic/itc": "3.23.0",
79
- "@platformatic/telemetry": "3.23.0"
74
+ "@platformatic/basic": "3.24.0-alpha0",
75
+ "@platformatic/generators": "3.24.0-alpha0",
76
+ "@platformatic/itc": "3.24.0-alpha0",
77
+ "@platformatic/foundation": "3.24.0-alpha0",
78
+ "@platformatic/metrics": "3.24.0-alpha0",
79
+ "@platformatic/telemetry": "3.24.0-alpha0"
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.23.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.24.0-alpha0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Runtime Config",
5
5
  "type": "object",
@@ -1421,10 +1421,6 @@
1421
1421
  }
1422
1422
  ]
1423
1423
  },
1424
- "backlog": {
1425
- "type": "integer",
1426
- "description": "The maximum length of the queue of pending connections"
1427
- },
1428
1424
  "http2": {
1429
1425
  "type": "boolean"
1430
1426
  },