feat: implement rateLimiterNode with fixed and sliding window strategies#49
Merged
MAlshaik merged 1 commit intoMar 27, 2026
Merged
Conversation
Adds a rate limiter primitive node that queues requests to stay within API rate limits. Supports both fixed window (batch-based) and sliding window (timestamp-based) strategies with Zod-validated I/O schemas. - Fixed window: processes items in batches, sleeps windowMs between batches - Sliding window: tracks per-request timestamps, waits only when window is full - Input: items[], requestsPerWindow (1–10000), windowMs (100–3600000), strategy - Output: processedItems, totalItems, totalDurationMs, echoed config metadata - Runtime guard for requestsPerWindow < 1 (belt-and-suspenders beyond schema) - 28 unit tests covering schema validation, ordering, timing assertions, output schema, and runtime error handling
MAlshaik
added a commit
that referenced
this pull request
Mar 30, 2026
…ngine-level rate limiting Both PRs implemented cross-cutting concerns as standalone wrapper nodes, contradicting the execution-engine direction established in Issue #37 and PR #39. retryNode was non-functional (always returned on first attempt), and rateLimiterNode was a sleep-based passthrough that didn't actually rate-limit API calls. Rate limiting is now a first-class ExecutionConfig option alongside retry, cache, and timeout — configured via RateLimitConfig with a pluggable RateLimitStore interface and MemoryRateLimitStore default implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: implement
rateLimiterNode— fixed & sliding window rate limitingCloses #11
What this adds
A
rate_limiterprimitive node that queues a list of items through a rate-limited pipeline, preventing downstream API calls from exceeding configured limits. Supports two strategies:requestsPerWindow, sleepingwindowMsbetween each batchInput schema
Output schema
Design decisions
category: 'logic''logic'matches all comparable nodes (delayNode,conditionalNode)supportsCancel: falsesupportsRerun: truerequestsPerWindow < 1min(1); prevents an infinite loop if the executor is called directlyTests — 28 cases covering
type,category,capabilities)totalDurationMs >= windowMs)requestsPerWindow: 0rejection + executor-level runtime guard