chore(fetcher): retry unexpected exceptions
This commit is contained in:
parent
34b7fddfc7
commit
5ac359f1eb
1 changed files with 7 additions and 0 deletions
|
|
@ -338,6 +338,13 @@ export class Fetcher {
|
|||
throw new TimeoutError();
|
||||
}
|
||||
|
||||
if (tryCount < 3) {
|
||||
this.logger.warn(`Retrying fetch ${init?.method ?? 'GET'} ${url} because of an unexpected error`, ctx);
|
||||
await this.sleep(333);
|
||||
|
||||
return await this.fetchWithTimeout(ctx, url, init, ++tryCount);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue