MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / exponentialBackoff

Function exponentialBackoff

packages/trigger-sdk/src/apiClient.ts:1052–1061  ·  view source on GitHub ↗
(retryCount: number)

Source from the content-addressed store, hash-verified

1050
1051// First retry will have a delay of 80ms, second 160ms, third 320ms, etc.
1052function 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
1063function safeJsonParse(rawBody: string) {
1064 try {

Callers 3

zodfetchWithVersionsFunction · 0.70
fetchHeadFunction · 0.70
zodfetchFunction · 0.70

Calls 2

minMethod · 0.80
randomMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…