Skip to content

Commit

Permalink
Added warning logging for retries
Browse files Browse the repository at this point in the history
  • Loading branch information
dhr-verma committed Mar 11, 2025
1 parent 944c054 commit 35c1994
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions server/routerlicious/packages/services-core/src/runWithRetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@ export async function runWithRetry<T>(
onErrorFn(error);
}
latestResultError = error;
Lumberjack.error(
`Error running ${callName}: retryCount ${retryCount}`,
telemetryProperties,
error,
);
if (retryCount < maxRetries && maxRetries !== -1) {
Lumberjack.warning(
`Error running ${callName}: retryCount ${retryCount}`,
telemetryProperties,
error,
);
} else {
Lumberjack.error(
`Error running ${callName}: retryCount ${retryCount}`,
telemetryProperties,
error,
)
}
if (shouldIgnoreError !== undefined && shouldIgnoreError(error) === true) {
Lumberjack.info(`Should ignore error for ${callName}`, telemetryProperties);
return undefined as unknown as T; // Ensure a value of type T is returned
Expand Down Expand Up @@ -179,11 +187,19 @@ export async function requestWithRetry<T>(
onErrorFn(error);
}
latestResultError = error;
Lumberjack.error(
`Error running ${callName}: retryCount ${retryCount}`,
telemetryProperties,
error,
);
if (retryCount < maxRetries && maxRetries !== -1) {
Lumberjack.warning(
`Error running ${callName}: retryCount ${retryCount}`,
telemetryProperties,
error,
);
} else {
Lumberjack.error(
`Error running ${callName}: retryCount ${retryCount}`,
telemetryProperties,
error,
)
}
if (shouldRetry !== undefined && shouldRetry(error) === false) {
Lumberjack.error(
`Should not retry ${callName} for the current error, rejecting`,
Expand Down

0 comments on commit 35c1994

Please sign in to comment.