Skip to content

Commit e1b03ab

Browse files
committed
fix(page): serialize local image uploads to respect Notion rate limits
prepareLocalImageUploads fanned out up to four uploads in parallel, but each upload fires three sequential official-API calls (create, send, then poll), so even two in-flight uploads easily exceed Notion's documented ~3 req/sec average limit. Without a shared rate limiter or 429/Retry-After handling, multi-image sync hits HTTP 429 nondeterministically. Drop the concurrency limit to 1 so uploads proceed serially and stay under the documented budget; full rate-limit/backoff infrastructure can land separately.
1 parent 38b6876 commit e1b03ab

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

cmd/page_local_images.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ import (
1515
"github.com/lox/notion-cli/internal/output"
1616
)
1717

18-
// localImageUploadConcurrency caps concurrent local image uploads.
19-
const localImageUploadConcurrency = 4
18+
// localImageUploadConcurrency caps concurrent local image uploads. Each
19+
// upload fires at least three sequential Notion API calls (create file
20+
// upload, send, then poll for upload status), so even serial work lives
21+
// right at Notion's documented ~3 req/sec average limit. Fanning out
22+
// in parallel without a shared rate limiter and 429/Retry-After backoff
23+
// reliably trips rate limits on pages with several images.
24+
const localImageUploadConcurrency = 1
2025

2126
type uploadedLocalImage struct {
2227
Alt string

0 commit comments

Comments
 (0)