Skip to content

Commit

Permalink
docs: added a debug and change comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryrden authored and sinedied committed Jul 18, 2024
1 parent f4e3a29 commit 7ff10b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async function retryRequest(fn: () => Promise<RemoteArticleData>, retries: numbe
if (retries === 0 || !(error instanceof RequestError && error.response?.statusCode === 429)) {
throw error;
}
debug('Rate limited, retrying in %s ms', retryDelay);

Check failure on line 34 in src/api.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, >=18)

Expected blank line before this statement.

Check failure on line 34 in src/api.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, >=18)

Expected blank line before this statement.
await delay(retryDelay);
return retryRequest(fn, retries - 1);
}
Expand Down Expand Up @@ -96,7 +97,7 @@ export async function updateRemoteArticle(article: Article, devtoKey: string): P
try {
const markdown = matter.stringify(article, article.data, { lineWidth: -1 } as any);
const { id } = article.data;
// Throttle API calls in case of article creation
// Throttle API calls in case of article creation or update
const get = id ? throttledPutForUpdate : throttledPostForCreate;
const result = await get(`${apiUrl}/articles${id ? `/${id}` : ''}`, {
headers: { 'api-key': devtoKey },
Expand Down

0 comments on commit 7ff10b3

Please sign in to comment.