Skip to content

Commit

Permalink
Better 429 request logging
Browse files Browse the repository at this point in the history
N2D4 committed Dec 27, 2024
1 parent 42c5e2f commit 285c51b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/stack-shared/src/interface/clientInterface.ts
Original file line number Diff line number Diff line change
@@ -356,9 +356,11 @@ export class StackClientInterface {
// Rate limited, so retry if we can
const retryAfter = res.headers.get("Retry-After");
if (retryAfter !== null) {
console.log(`Rate limited while sending request to ${url}. Will retry after ${retryAfter} seconds...`);
await wait(Number(retryAfter) * 1000);
return Result.error(new Error(`Rate limited, retrying after ${retryAfter} seconds`));
}
console.log(`Rate limited while sending request to ${url}, no retry-after header received. Retrying...`);
return Result.error(new Error("Rate limited, no retry-after header received"));
} else {
const error = await res.text();

0 comments on commit 285c51b

Please sign in to comment.