@nxtedition/nxt-undici 6.0.13 → 6.0.15
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.
|
@@ -152,7 +152,7 @@ class Handler extends DecoratorHandler {
|
|
|
152
152
|
|
|
153
153
|
let retryPromise
|
|
154
154
|
try {
|
|
155
|
-
retryPromise = retryFn(err, this.#retryCount,
|
|
155
|
+
retryPromise = retryFn(err, this.#retryCount, this.#opts)
|
|
156
156
|
} catch (err) {
|
|
157
157
|
retryPromise = Promise.reject(err)
|
|
158
158
|
}
|
package/lib/utils.js
CHANGED
|
@@ -80,19 +80,21 @@ export function parseContentRange(range) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export async function retry(err, retryCount, opts) {
|
|
83
|
-
|
|
83
|
+
let retryOpts = opts?.retry
|
|
84
|
+
|
|
85
|
+
if (retryOpts) {
|
|
84
86
|
throw err
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
if (typeof
|
|
88
|
-
return
|
|
89
|
+
if (typeof retryOpts === 'function') {
|
|
90
|
+
return retryOpts(err, retryCount, opts, () => retry(err, retryCount, opts))
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
if (typeof
|
|
92
|
-
|
|
93
|
+
if (typeof retryOpts === 'number') {
|
|
94
|
+
retryOpts = { count: retryOpts }
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
const retryMax =
|
|
97
|
+
const retryMax = retryOpts?.count ?? 8
|
|
96
98
|
|
|
97
99
|
if (retryCount > retryMax) {
|
|
98
100
|
throw err
|