mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-13 07:00:04 +01:00
Eliminate a redundant variable
Co-authored-by: liamwhite <liamwhite@users.noreply.github.com>
This commit is contained in:
parent
647bd987ba
commit
8294d398ed
1 changed files with 2 additions and 3 deletions
|
@ -73,11 +73,10 @@ export async function retry<R>(func: RetryFunc<R>, params?: RetryParams): Promis
|
||||||
const hasNextAttempts = attempt < maxAttempts;
|
const hasNextAttempts = attempt < maxAttempts;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// XXX: an `await` is important in this block to make sure the exception is caught
|
// NB: an `await` is important in this block to make sure the exception is caught
|
||||||
// in this scope. Doing a `return func()` would be a big mistake, so don't try
|
// in this scope. Doing a `return func()` would be a big mistake, so don't try
|
||||||
// to "refactor" that!
|
// to "refactor" that!
|
||||||
const result = await func(attempt, hasNextAttempts ? nextDelayMs : undefined);
|
return await func(attempt, hasNextAttempts ? nextDelayMs : undefined);
|
||||||
return result;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!(error instanceof Error) || (params?.isRetryable && !params.isRetryable(error))) {
|
if (!(error instanceof Error) || (params?.isRetryable && !params.isRetryable(error))) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|
Loading…
Add table
Reference in a new issue