@platformatic/basic 3.24.0-alpha0 → 3.24.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/config.d.ts CHANGED
@@ -81,6 +81,10 @@ export interface PlatformaticBasicConfig {
81
81
  server?: {
82
82
  hostname?: string;
83
83
  port?: number | string;
84
+ /**
85
+ * The maximum length of the queue of pending connections
86
+ */
87
+ backlog?: number;
84
88
  http2?: boolean;
85
89
  https?: {
86
90
  allowHTTP1?: boolean;
package/lib/capability.js CHANGED
@@ -487,7 +487,7 @@ export class BaseCapability extends EventEmitter {
487
487
  })
488
488
 
489
489
  this.childManager.on('event', event => {
490
- globalThis[kITC].notify('event', event)
490
+ globalThis[kITC]?.notify('event', event)
491
491
  this.emit('application:worker:event:' + event.event, event.payload)
492
492
  })
493
493
 
@@ -586,6 +586,12 @@ export class BaseCapability extends EventEmitter {
586
586
  /* c8 ignore next 2 - else */
587
587
  port: (this.isEntrypoint ? this.serverConfig?.port || 0 : undefined) ?? true,
588
588
  host: (this.isEntrypoint ? this.serverConfig?.hostname : undefined) ?? true,
589
+ additionalServerOptions:
590
+ typeof this.serverConfig?.backlog === 'number'
591
+ ? {
592
+ backlog: this.serverConfig.backlog
593
+ }
594
+ : {},
589
595
  telemetryConfig: this.telemetryConfig
590
596
  }
591
597
  }
@@ -360,6 +360,7 @@ export class ChildProcess extends ITC {
360
360
 
361
361
  const port = globalThis.platformatic.port
362
362
  const host = globalThis.platformatic.host
363
+ const additionalOptions = globalThis.platformatic.additionalServerOptions ?? {}
363
364
 
364
365
  if (port !== false) {
365
366
  const hasFixedPort = typeof port === 'number'
@@ -369,6 +370,9 @@ export class ChildProcess extends ITC {
369
370
  if (typeof host === 'string') {
370
371
  options.host = host
371
372
  }
373
+
374
+ Object.assign(options, additionalOptions)
375
+ globalThis.platformatic?.events?.emitAndNotify('serverOptions', options)
372
376
  },
373
377
  asyncEnd: ({ server }) => {
374
378
  tracingChannel('net.server.listen').unsubscribe(subscribers)
@@ -1,6 +1,6 @@
1
1
  import { subscribe, tracingChannel, unsubscribe } from 'node:diagnostics_channel'
2
2
 
3
- export function createServerListener (overridePort = true, overrideHost) {
3
+ export function createServerListener (overridePort = true, overrideHost = false, additionalOptions = {}) {
4
4
  const { promise, resolve, reject } = Promise.withResolvers()
5
5
 
6
6
  const subscribers = {
@@ -18,6 +18,9 @@ export function createServerListener (overridePort = true, overrideHost) {
18
18
  if (typeof overrideHost === 'string') {
19
19
  options.host = overrideHost
20
20
  }
21
+
22
+ Object.assign(options, additionalOptions)
23
+ globalThis.platformatic?.events?.emitAndNotify('serverOptions', options)
21
24
  },
22
25
  asyncEnd ({ server }) {
23
26
  cancel()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "3.24.0-alpha0",
3
+ "version": "3.24.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -25,10 +25,10 @@
25
25
  "split2": "^4.2.0",
26
26
  "undici": "^7.0.0",
27
27
  "ws": "^8.18.0",
28
- "@platformatic/foundation": "3.24.0-alpha0",
29
- "@platformatic/metrics": "3.24.0-alpha0",
30
- "@platformatic/itc": "3.24.0-alpha0",
31
- "@platformatic/telemetry": "3.24.0-alpha0"
28
+ "@platformatic/foundation": "3.24.0",
29
+ "@platformatic/telemetry": "3.24.0",
30
+ "@platformatic/itc": "3.24.0",
31
+ "@platformatic/metrics": "3.24.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "cleaner-spec-reporter": "^0.5.0",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/basic/3.24.0-alpha0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/basic/3.24.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Basic Config",
5
5
  "type": "object",
@@ -549,6 +549,10 @@
549
549
  }
550
550
  ]
551
551
  },
552
+ "backlog": {
553
+ "type": "integer",
554
+ "description": "The maximum length of the queue of pending connections"
555
+ },
552
556
  "http2": {
553
557
  "type": "boolean"
554
558
  },