@nxtedition/nxt-undici 6.0.11 → 6.0.12
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/lib/interceptor/dns.js +6 -8
- package/package.json +1 -1
package/lib/interceptor/dns.js
CHANGED
|
@@ -50,6 +50,7 @@ export default () => (dispatch) => {
|
|
|
50
50
|
expires: now + Math.min(MAX_TTL, 1e3 * ttl),
|
|
51
51
|
pending: 0,
|
|
52
52
|
errored: 0,
|
|
53
|
+
counter: 0,
|
|
53
54
|
}))
|
|
54
55
|
cache.set(hostname, ret)
|
|
55
56
|
return ret
|
|
@@ -94,7 +95,7 @@ export default () => (dispatch) => {
|
|
|
94
95
|
return a.pending - b.pending
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
return
|
|
98
|
+
return a.counter - b.counter
|
|
98
99
|
})
|
|
99
100
|
|
|
100
101
|
const record = records.find((x) => x.expires >= now)
|
|
@@ -107,6 +108,7 @@ export default () => (dispatch) => {
|
|
|
107
108
|
|
|
108
109
|
origin.hostname = record.address
|
|
109
110
|
|
|
111
|
+
record.counter++
|
|
110
112
|
record.pending++
|
|
111
113
|
try {
|
|
112
114
|
return dispatch(
|
|
@@ -114,13 +116,9 @@ export default () => (dispatch) => {
|
|
|
114
116
|
new Handler(handler, (err, statusCode) => {
|
|
115
117
|
record.pending--
|
|
116
118
|
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} else {
|
|
121
|
-
record.errored = 0
|
|
122
|
-
}
|
|
123
|
-
} else if (err.name !== 'AbortError') {
|
|
119
|
+
if (statusCode != null && statusCode >= 500) {
|
|
120
|
+
record.errored++
|
|
121
|
+
} else if (err != null && err.name !== 'AbortError') {
|
|
124
122
|
record.expires = 0
|
|
125
123
|
}
|
|
126
124
|
}),
|