mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
fix: Temporary fix for retry bug
This commit is contained in:
parent
af753bf270
commit
b4aa73dea1
1 changed files with 6 additions and 6 deletions
|
|
@ -120,18 +120,18 @@ export class GithubApiService extends GithubRepository {
|
||||||
CONSTANTS.DEFAULT_GITHUB_RETRY_DELAY,
|
CONSTANTS.DEFAULT_GITHUB_RETRY_DELAY,
|
||||||
);
|
);
|
||||||
const response = await retry.fetch<Promise<T>>(async ({ attempt }) => {
|
const response = await retry.fetch<Promise<T>>(async ({ attempt }) => {
|
||||||
return await soxa.post("", {}, {
|
const res = await soxa.post("", {}, {
|
||||||
data: { query: query, variables },
|
data: { query: query, variables },
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `bearer ${TOKENS[attempt]}`,
|
Authorization: `bearer ${TOKENS[attempt]}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (res?.data?.errors) {
|
||||||
|
return this.handleError(res?.data?.errors);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}) as QueryDefaultResponse<{ user: T }>;
|
}) as QueryDefaultResponse<{ user: T }>;
|
||||||
|
|
||||||
if (response?.data?.errors) {
|
|
||||||
return this.handleError(response?.data?.errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response?.data?.data?.user ??
|
return response?.data?.data?.user ??
|
||||||
new ServiceError("not found", EServiceKindError.NOT_FOUND);
|
new ServiceError("not found", EServiceKindError.NOT_FOUND);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -146,7 +146,7 @@ export class GithubApiService extends GithubRepository {
|
||||||
Logger.error(error);
|
Logger.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ServiceError("not found", EServiceKindError.NOT_FOUND);
|
return new ServiceError("Rate limit exceeded", EServiceKindError.RATE_LIMIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue