[Discussion] Notion To MD v4: Block Fetcher Technical Details #114
souvikinator
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Block Fetcher Technical Doc
Overview
The module acts as an fetching layer that handles the complexity of retrieving nested Notion content while balancing performance and API constraints. It's designed to solve several challenges:
Concurrent Block Fetching
Instead of fetching blocks sequentially or recursively (which was a performance bottleneck in previous versions)
a. it implements a batch processing system. All elements of the batch are processed concurrently.
b. The code uses a configurable batch size (default: 3) to fetch multiple blocks concurrently while staying within API limits.
Rate Limiting Management
The component implements a configurable rate limiting system:
a. Tracks requests per second (default max: 3)
b. Implements cooldown periods when limits are reached
State Management
It maintains several internal data structures:
a. queue: Tracks blocks that need processing
b. results: Stores fetched blocks
c. pageProps: Stores page properties
d. processedBlocks: Prevents duplicate processing
Block Organization
The component handles the complexity of Notion's nested structure:
a. Maintains parent-child relationships
b. Preserves block ordering
c. Supports child page content (optional)
d. Handles page properties (optional)
Configuration Options
The BlockFetcher accepts the following configuration parameters:
Detailed Implementation Flow
Interface
Beta Was this translation helpful? Give feedback.
All reactions