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 committed Jul 17, 2024
1 parent 19ab420 commit be0fa85
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);
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 be0fa85

Please sign in to comment.