From 7ff10b3847ca8f7bf9df0f2f4b5cf490f6cfba92 Mon Sep 17 00:00:00 2001 From: Ryan S Date: Wed, 17 Jul 2024 10:21:57 -0300 Subject: [PATCH] docs: added a debug and change comment --- src/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index d5bd8c6..2eaf992 100644 --- a/src/api.ts +++ b/src/api.ts @@ -31,6 +31,7 @@ async function retryRequest(fn: () => Promise, 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); } @@ -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 },