@upyo/retry 0.5.0-dev.201 → 0.5.0-dev.205
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/dist/index.cjs +3 -2
- package/dist/index.js +3 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -241,6 +241,7 @@ var RetryTransport = class {
|
|
|
241
241
|
try {
|
|
242
242
|
startLaunch();
|
|
243
243
|
while (inFlight.size > 0 || completed.has(nextYieldIndex) || launchPromise != null || !inputDone) {
|
|
244
|
+
combinedSignal.signal.throwIfAborted();
|
|
244
245
|
while (completed.has(nextYieldIndex)) {
|
|
245
246
|
const result$1 = completed.get(nextYieldIndex);
|
|
246
247
|
completed.delete(nextYieldIndex);
|
|
@@ -254,7 +255,7 @@ var RetryTransport = class {
|
|
|
254
255
|
startLaunch();
|
|
255
256
|
if (inFlight.size <= 0 && launchPromise == null) break;
|
|
256
257
|
const launch = launchPromise?.then(() => ({ launched: true }));
|
|
257
|
-
const result = await Promise.race([...inFlight.values(), ...launch == null ? [] : [launch]]);
|
|
258
|
+
const result = await raceWithAbort(Promise.race([...inFlight.values(), ...launch == null ? [] : [launch]]), combinedSignal.signal);
|
|
258
259
|
if ("launched" in result) continue;
|
|
259
260
|
inFlight.delete(result.index);
|
|
260
261
|
completed.set(result.index, result);
|
|
@@ -340,7 +341,7 @@ var RetryTransport = class {
|
|
|
340
341
|
}
|
|
341
342
|
calculateDelay(attempt, failure) {
|
|
342
343
|
const retryAfterMilliseconds = getRetryAfterMilliseconds(failure);
|
|
343
|
-
const cappedRetryAfter = retryAfterMilliseconds == null || !Number.isFinite(retryAfterMilliseconds) || retryAfterMilliseconds
|
|
344
|
+
const cappedRetryAfter = retryAfterMilliseconds == null || !Number.isFinite(retryAfterMilliseconds) || retryAfterMilliseconds < 0 ? void 0 : Math.min(retryAfterMilliseconds, this.config.backoff.maxDelayMilliseconds);
|
|
344
345
|
if (cappedRetryAfter != null) return cappedRetryAfter;
|
|
345
346
|
const computedDelay = Math.min(this.config.backoff.baseDelayMilliseconds * Math.pow(this.config.backoff.factor, attempt - 1), this.config.backoff.maxDelayMilliseconds);
|
|
346
347
|
if (this.config.jitter === false || this.config.jitter === "none") return computedDelay;
|
package/dist/index.js
CHANGED
|
@@ -218,6 +218,7 @@ var RetryTransport = class {
|
|
|
218
218
|
try {
|
|
219
219
|
startLaunch();
|
|
220
220
|
while (inFlight.size > 0 || completed.has(nextYieldIndex) || launchPromise != null || !inputDone) {
|
|
221
|
+
combinedSignal.signal.throwIfAborted();
|
|
221
222
|
while (completed.has(nextYieldIndex)) {
|
|
222
223
|
const result$1 = completed.get(nextYieldIndex);
|
|
223
224
|
completed.delete(nextYieldIndex);
|
|
@@ -231,7 +232,7 @@ var RetryTransport = class {
|
|
|
231
232
|
startLaunch();
|
|
232
233
|
if (inFlight.size <= 0 && launchPromise == null) break;
|
|
233
234
|
const launch = launchPromise?.then(() => ({ launched: true }));
|
|
234
|
-
const result = await Promise.race([...inFlight.values(), ...launch == null ? [] : [launch]]);
|
|
235
|
+
const result = await raceWithAbort(Promise.race([...inFlight.values(), ...launch == null ? [] : [launch]]), combinedSignal.signal);
|
|
235
236
|
if ("launched" in result) continue;
|
|
236
237
|
inFlight.delete(result.index);
|
|
237
238
|
completed.set(result.index, result);
|
|
@@ -317,7 +318,7 @@ var RetryTransport = class {
|
|
|
317
318
|
}
|
|
318
319
|
calculateDelay(attempt, failure) {
|
|
319
320
|
const retryAfterMilliseconds = getRetryAfterMilliseconds(failure);
|
|
320
|
-
const cappedRetryAfter = retryAfterMilliseconds == null || !Number.isFinite(retryAfterMilliseconds) || retryAfterMilliseconds
|
|
321
|
+
const cappedRetryAfter = retryAfterMilliseconds == null || !Number.isFinite(retryAfterMilliseconds) || retryAfterMilliseconds < 0 ? void 0 : Math.min(retryAfterMilliseconds, this.config.backoff.maxDelayMilliseconds);
|
|
321
322
|
if (cappedRetryAfter != null) return cappedRetryAfter;
|
|
322
323
|
const computedDelay = Math.min(this.config.backoff.baseDelayMilliseconds * Math.pow(this.config.backoff.factor, attempt - 1), this.config.backoff.maxDelayMilliseconds);
|
|
323
324
|
if (this.config.jitter === false || this.config.jitter === "none") return computedDelay;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/retry",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.205",
|
|
4
4
|
"description": "Retry and backoff decorator transport for Upyo email library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false,
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@upyo/core": "0.5.0-dev.
|
|
57
|
+
"@upyo/core": "0.5.0-dev.205+0a836319"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"tsdown": "^0.12.7",
|