mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-12 14:40:03 +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;
|
||||
|
||||
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
|
||||
// to "refactor" that!
|
||||
const result = await func(attempt, hasNextAttempts ? nextDelayMs : undefined);
|
||||
return result;
|
||||
return await func(attempt, hasNextAttempts ? nextDelayMs : undefined);
|
||||
} catch (error) {
|
||||
if (!(error instanceof Error) || (params?.isRetryable && !params.isRetryable(error))) {
|
||||
throw error;
|
||||
|
|
Loading…
Add table
Reference in a new issue