Skip to content

Commit

Permalink
fix(animegarden): must run retry
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Sep 20, 2024
1 parent 8fbef69 commit 31374ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/animegarden/src/garden/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function fetchResources<T extends FetchResourcesOptions = FetchReso
fetch: (request: RequestInfo, init?: RequestInit) => Promise<Response>,
options: T = {} as T
): Promise<FetchResourcesResult<FetchResourcesOptions>> {
const { baseURL = DefaultBaseURL, retry = 1 } = options;
const { baseURL = DefaultBaseURL, retry = 0 } = options;

const url = stringifySearchURL(baseURL, options);

Expand Down Expand Up @@ -191,7 +191,7 @@ export async function fetchResourceDetail(
href: string,
options: FetchResourceDetailOptions = {}
): Promise<(ResourceDetail & { id: number }) | undefined> {
const { baseURL = DefaultBaseURL, retry = 1 } = options;
const { baseURL = DefaultBaseURL, retry = 0 } = options;
const url = new URL(`${provider}/detail/${href}`, baseURL);

const resp = await retryFn(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/animegarden/src/garden/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function retryFn<T>(fn: () => Promise<T>, count: number): Promise<T
count = Number.MAX_SAFE_INTEGER;
}
let e: any;
for (let i = 0; i < count; i++) {
for (let i = 0; i <= count; i++) {
try {
return await fn();
} catch (err) {
Expand Down

0 comments on commit 31374ee

Please sign in to comment.