(retryCount: number)
| 1050 | |
| 1051 | // First retry will have a delay of 80ms, second 160ms, third 320ms, etc. |
| 1052 | function exponentialBackoff(retryCount: number): number { |
| 1053 | // Calculate the delay using the exponential backoff formula |
| 1054 | const delay = Math.min(Math.pow(EXPONENT_FACTOR, retryCount) * MIN_DELAY_IN_MS, MAX_DELAY_IN_MS); |
| 1055 | |
| 1056 | // Calculate the jitter |
| 1057 | const jitterValue = Math.random() * JITTER_IN_MS; |
| 1058 | |
| 1059 | // Return the calculated delay with jitter |
| 1060 | return delay + jitterValue; |
| 1061 | } |
| 1062 | |
| 1063 | function safeJsonParse(rawBody: string) { |
| 1064 | try { |
no test coverage detected
searching dependent graphs…