@nxtedition/lib 19.5.7 → 19.6.1
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 +5 -2
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -5,7 +5,7 @@ import stream from 'node:stream'
|
|
|
5
5
|
import { Buffer } from 'node:buffer'
|
|
6
6
|
import { getDockerSecretsSync } from './docker-secrets.js'
|
|
7
7
|
import fp from 'lodash/fp.js'
|
|
8
|
-
import { isMainThread, parentPort } from 'node:worker_threads'
|
|
8
|
+
import { isMainThread, parentPort, threadId } from 'node:worker_threads'
|
|
9
9
|
import toobusy from 'toobusy-js'
|
|
10
10
|
import deepstream from '@nxtedition/deepstream.io-client-js'
|
|
11
11
|
import { createLogger } from './logger.js'
|
|
@@ -108,6 +108,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
108
108
|
const serviceName = appConfig.name
|
|
109
109
|
const serviceModule = appConfig.module ?? 'main'
|
|
110
110
|
const serviceVersion = appConfig.version
|
|
111
|
+
const serviceWorkerId = appConfig.workerId ?? threadId
|
|
111
112
|
const serviceInstanceId =
|
|
112
113
|
// process.env.name is the pm2 name of the process
|
|
113
114
|
appConfig.instanceId ?? appConfig.containerId ?? process.env.name ?? os.hostname()
|
|
@@ -117,7 +118,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
117
118
|
(serviceName &&
|
|
118
119
|
`${serviceName}/${
|
|
119
120
|
serviceVersion || '*'
|
|
120
|
-
} (module:${serviceModule}; instance:${serviceInstanceId}) Node/${process.version}`) ??
|
|
121
|
+
} (module:${serviceModule}; instance:${serviceInstanceId}) worker:${serviceWorkerId} Node/${process.version}`) ??
|
|
121
122
|
null)
|
|
122
123
|
|
|
123
124
|
{
|
|
@@ -133,6 +134,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
133
134
|
base: {
|
|
134
135
|
module: serviceModule,
|
|
135
136
|
pid: process.pid,
|
|
137
|
+
tid: threadId,
|
|
136
138
|
hostname: os.hostname(),
|
|
137
139
|
...loggerConfig.base,
|
|
138
140
|
},
|
|
@@ -741,6 +743,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
741
743
|
serviceModule,
|
|
742
744
|
serviceVersion,
|
|
743
745
|
serviceInstanceId,
|
|
746
|
+
serviceWorkerId,
|
|
744
747
|
signal: ac.signal,
|
|
745
748
|
}
|
|
746
749
|
}
|