mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
Use Retry-After header for Notion rate-limit retries (#9467)
This commit is contained in:
@@ -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})`
|
||||
|
||||
Reference in New Issue
Block a user