@nxtedition/lib 18.0.5 → 18.0.7
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 +0 -13
- package/couch.js +7 -2
- package/package.json +1 -2
package/app.js
CHANGED
|
@@ -20,8 +20,6 @@ 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'
|
|
25
23
|
|
|
26
24
|
export function makeApp(appConfig, onTerminate) {
|
|
27
25
|
let ds
|
|
@@ -50,17 +48,6 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
50
48
|
const isProduction = process.env.NODE_ENV === 'production'
|
|
51
49
|
const ac = new AbortController()
|
|
52
50
|
|
|
53
|
-
const dnsCache = new CacheableLookup({
|
|
54
|
-
maxTtl: 10e3,
|
|
55
|
-
})
|
|
56
|
-
undici.setGlobalDispatcher(
|
|
57
|
-
new undici.Agent({
|
|
58
|
-
connect: {
|
|
59
|
-
lookup: dnsCache.lookup,
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
51
|
// Crash on unhandledRejection
|
|
65
52
|
process.on('unhandledRejection', (err) => {
|
|
66
53
|
throw err
|
package/couch.js
CHANGED
|
@@ -304,6 +304,7 @@ export function makeCouch(opts) {
|
|
|
304
304
|
idempotent: true,
|
|
305
305
|
blocking: live,
|
|
306
306
|
method,
|
|
307
|
+
maxRedirects: 4,
|
|
307
308
|
body: JSON.stringify(body),
|
|
308
309
|
signal: ac.signal,
|
|
309
310
|
headers: {
|
|
@@ -375,12 +376,16 @@ export function makeCouch(opts) {
|
|
|
375
376
|
}
|
|
376
377
|
return
|
|
377
378
|
} catch (err) {
|
|
379
|
+
err.reason ??= err.body?.reason
|
|
378
380
|
if (err.name === 'AbortError' || client.destroyed) {
|
|
379
381
|
throw err
|
|
380
382
|
} else if (typeof retry === 'function') {
|
|
381
383
|
const retryState = { since: params.since }
|
|
382
|
-
Object.assign(
|
|
383
|
-
|
|
384
|
+
Object.assign(
|
|
385
|
+
retryState,
|
|
386
|
+
await retry(err, retryCount++, retryState, { signal }, () =>
|
|
387
|
+
delay(err, retryCount, { signal }),
|
|
388
|
+
),
|
|
384
389
|
)
|
|
385
390
|
params.since = retryState.since ?? 0
|
|
386
391
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -77,7 +77,6 @@
|
|
|
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",
|
|
81
80
|
"date-fns": "^3.1.0",
|
|
82
81
|
"fast-querystring": "^1.1.1",
|
|
83
82
|
"hasha": "^6.0.0",
|