@nxtedition/lib 17.2.14 → 17.2.16

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 (2) hide show
  1. package/app.js +14 -1
  2. package/package.json +2 -1
package/app.js CHANGED
@@ -20,6 +20,8 @@ import hashString from './hash.js'
20
20
  import { makeTrace } from './trace.js'
21
21
  import compose from 'koa-compose'
22
22
  import { createServer } from './http.js'
23
+ import CacheableLookup from 'cacheable-lookup'
24
+ import undici from 'undici'
23
25
 
24
26
  export function makeApp(appConfig, onTerminate) {
25
27
  let ds
@@ -46,6 +48,17 @@ export function makeApp(appConfig, onTerminate) {
46
48
  const isProduction = process.env.NODE_ENV === 'production'
47
49
  const ac = new AbortController()
48
50
 
51
+ const dnsCache = new CacheableLookup({
52
+ maxTtl: 10e3,
53
+ })
54
+ undici.setGlobalDispatcher(
55
+ new undici.Agent({
56
+ connect: {
57
+ lookup: dnsCache.lookup,
58
+ },
59
+ }),
60
+ )
61
+
49
62
  // Crash on unhandledRejection
50
63
  process.on('unhandledRejection', (err) => {
51
64
  throw err
@@ -172,7 +185,7 @@ export function makeApp(appConfig, onTerminate) {
172
185
  setTimeout(() => {
173
186
  logger.error('aborting')
174
187
  if (isMainThread) {
175
- process.abort()
188
+ process.exit(1)
176
189
  } else {
177
190
  // TODO (fix): What to do here?
178
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "17.2.14",
3
+ "version": "17.2.16",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -77,6 +77,7 @@
77
77
  "@elastic/elasticsearch": "^8.12.1",
78
78
  "@elastic/transport": "^8.4.0",
79
79
  "@nxtedition/nxt-undici": "^2.0.35",
80
+ "cacheable-lookup": "^7.0.0",
80
81
  "date-fns": "^3.1.0",
81
82
  "fast-querystring": "^1.1.1",
82
83
  "hasha": "^6.0.0",