@nxtedition/nxt-undici 2.2.3 → 2.2.5
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/cache.js +0 -2
- package/lib/utils.js +5 -9
- package/package.json +1 -1
package/lib/interceptor/cache.js
CHANGED
|
@@ -190,10 +190,8 @@ export default (dispatch) => (opts, handler) => {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
handler.onComplete(rawTrailers)
|
|
193
|
-
signal.throwIfAborted()
|
|
194
193
|
} else {
|
|
195
194
|
handler.onComplete([])
|
|
196
|
-
signal.throwIfAborted()
|
|
197
195
|
}
|
|
198
196
|
} catch (err) {
|
|
199
197
|
handler.onError(err)
|
package/lib/utils.js
CHANGED
|
@@ -70,17 +70,13 @@ export function parseContentRange(range) {
|
|
|
70
70
|
return { start, end: end ? end + 1 : size, size }
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export function retry(err, retryCount, opts) {
|
|
73
|
+
export async function retry(err, retryCount, opts) {
|
|
74
74
|
if (!opts) {
|
|
75
|
-
|
|
75
|
+
throw err
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
if (typeof opts === 'function') {
|
|
79
|
-
|
|
80
|
-
return opts(err, retryCount, opts, (opts) => retry(err, retryCount, opts))
|
|
81
|
-
} catch (err) {
|
|
82
|
-
return Promise.reject(err)
|
|
83
|
-
}
|
|
79
|
+
return opts(err, retryCount, opts, (opts) => retry(err, retryCount, opts))
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
if (typeof opts === 'number') {
|
|
@@ -90,7 +86,7 @@ export function retry(err, retryCount, opts) {
|
|
|
90
86
|
const retryMax = opts?.count ?? 8
|
|
91
87
|
|
|
92
88
|
if (retryCount > retryMax) {
|
|
93
|
-
|
|
89
|
+
throw err
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
const statusCode = err.statusCode ?? err.status ?? err.$metadata?.httpStatusCode ?? null
|
|
@@ -125,7 +121,7 @@ export function retry(err, retryCount, opts) {
|
|
|
125
121
|
return tp.setTimeout(Math.min(10e3, retryCount * 1e3), undefined, { signal: opts.signal })
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
|
|
124
|
+
throw err
|
|
129
125
|
}
|
|
130
126
|
|
|
131
127
|
export function parseURL(url) {
|