@curl-runner/cli 1.7.0 → 1.8.0
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/package.json
CHANGED
|
@@ -101,7 +101,9 @@ export class RequestExecutor {
|
|
|
101
101
|
if (attempt > 0) {
|
|
102
102
|
requestLogger.logRetry(attempt, maxAttempts - 1);
|
|
103
103
|
if (config.retry?.delay) {
|
|
104
|
-
|
|
104
|
+
const backoff = config.retry.backoff ?? 1;
|
|
105
|
+
const delay = config.retry.delay * Math.pow(backoff, attempt - 1);
|
|
106
|
+
await Bun.sleep(delay);
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
|
package/src/types/config.ts
CHANGED
|
@@ -92,6 +92,9 @@ export interface RequestConfig {
|
|
|
92
92
|
retry?: {
|
|
93
93
|
count: number;
|
|
94
94
|
delay?: number;
|
|
95
|
+
/** Exponential backoff multiplier. Default is 1 (no backoff).
|
|
96
|
+
* Example: with delay=1000 and backoff=2, delays are: 1000ms, 2000ms, 4000ms, 8000ms... */
|
|
97
|
+
backoff?: number;
|
|
95
98
|
};
|
|
96
99
|
variables?: Record<string, string>;
|
|
97
100
|
/**
|