@nxtedition/lib 19.5.6 → 19.6.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.
Files changed (4) hide show
  1. package/app.js +4 -2
  2. package/couch.js +2 -2
  3. package/http.js +1 -2
  4. 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
  {
@@ -741,6 +742,7 @@ export function makeApp(appConfig, onTerminate) {
741
742
  serviceModule,
742
743
  serviceVersion,
743
744
  serviceInstanceId,
745
+ serviceWorkerId,
744
746
  signal: ac.signal,
745
747
  }
746
748
  }
package/couch.js CHANGED
@@ -179,7 +179,7 @@ export function makeCouch(opts) {
179
179
  if (options.heartbeat != null) {
180
180
  params.heartbeat = Number(options.heartbeat)
181
181
  } else {
182
- params.heartbeat = 10e3
182
+ params.heartbeat = 60e3
183
183
  }
184
184
 
185
185
  if (options.timeout != null) {
@@ -252,7 +252,7 @@ export function makeCouch(opts) {
252
252
  'request-id': genReqId(),
253
253
  ...(body ? { 'content-type': 'application/json' } : {}),
254
254
  },
255
- bodyTimeout: live ? 2 * (params.heartbeat || 60e3) : 2 * 60e3,
255
+ bodyTimeout: 2 * (params.heartbeat || 60e3),
256
256
  }
257
257
 
258
258
  const ures = await client.request(ureq)
package/http.js CHANGED
@@ -81,6 +81,7 @@ export async function request(ctx, next) {
81
81
  // 'end' or 'error' will always be emitted.
82
82
  .on('close', function () {
83
83
  resolve(null)
84
+ ac.abort()
84
85
  })
85
86
  }),
86
87
  ])
@@ -159,8 +160,6 @@ export async function request(ctx, next) {
159
160
  res.destroy()
160
161
  }
161
162
  }
162
-
163
- ac.abort(err)
164
163
  }
165
164
  }
166
165
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.5.6",
3
+ "version": "19.6.0",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",