Use Retry-After header for Notion rate-limit retries (#9467)

This commit is contained in:
Hemachandar
2025-06-19 02:09:58 +05:30
committed by GitHub
parent ecd5afa6cd
commit a3b3e9e0be
+5 -1
View File
@@ -107,7 +107,11 @@ export class NotionClient {
) {
if (retries < this.maxRetries) {
retries++;
const delay = this.retryDelay * retries;
const headers = error.headers as Record<string, string>;
const retryAfter = headers["Retry-After"]
? parseInt(headers["Retry-After"], 10) * 1000 // Convert seconds to milliseconds
: undefined;
const delay = retryAfter ?? this.retryDelay * retries;
Logger.info(
"task",
`Notion API rate limit hit, retrying in ${delay}ms (retry ${retries}/${this.maxRetries})`