Skip to content

Commit

Permalink
fix(plugin-server): clarify var name in retryIfRetriable (PostHog#18093)
Browse files Browse the repository at this point in the history
  • Loading branch information
bretthoerner authored and Justicea83 committed Oct 25, 2023
1 parent 6fe8dc1 commit 37b4891
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin-server/src/utils/retries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ export async function runRetriableFunction(retriableFunctionPayload: RetriableFu
/**
* Retry a function, respecting `error.isRetriable`.
*/
export async function retryIfRetriable<T>(fn: () => Promise<T>, retries = 3, sleepMs = 500): Promise<T> {
for (let i = 0; i < retries; i++) {
export async function retryIfRetriable<T>(fn: () => Promise<T>, tries = 3, sleepMs = 500): Promise<T> {
for (let i = 0; i < tries; i++) {
try {
return await fn()
} catch (error) {
if (error?.isRetriable === false || i === retries - 1) {
// Throw if the error is not retryable or if we're out of retries.
if (error?.isRetriable === false || i === tries - 1) {
// Throw if the error is not retryable or if we're out of tries.
throw error
}

Expand Down

0 comments on commit 37b4891

Please sign in to comment.