docs(batcher): explain that wait restarts on every addItem #290
main fromrefs/pull/290/head·opened 🎯 Changes#
Fixes #289.
Batcher, AsyncBatcher, and LiteBatcher clear and restart the wait timer on every addItem call, so wait is time since the last item was added. The wait option JSDoc called it the "maximum time to wait before processing a batch", and the class example said "After 2 seconds or when 5 items are added". Both read like a fixed window counted from the first item. The batching guides already describe it correctly ("Every added item restarts the timer").
This PR changes:
- The
waitoption doc inBatcherOptions,AsyncBatcherOptions, andLiteBatcherOptionsnow says the timer restarts on eachaddItem. - The class examples now say "2 seconds after the last item is added, or as soon as 5 items are added, whichever comes first".
- The
asyncBatchoptions list now sayswaitis counted from the last added item. - I regenerated
docs/referencewithpnpm generate-docsand only kept the pages for these comments.
Only comments and generated docs change; runtime behavior is the same.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm run test:pr, or these tests do not apply to this pull request. (Docs-only. I rantest:eslint,test:types,test:lib, andbuildfor@tanstack/pacerand@tanstack/pacer-lite, plusprettier --checkon the changed files.) - I fully understand the code in this pull request, including any code generated with AI assistance.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
- Documentation
- Clarified that the batch wait period starts over whenever an item is added, and processing occurs after the configured time passes without new items.
- Updated examples to explain that reaching the batch size limit can trigger processing before the wait period ends.
- Aligned descriptions across batcher options, classes, and the async batching function.
- 1
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: TanStack/pacer/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4e7f3245-1194-4667-aac1-34ebeac9c23a
📥 Commits
-
Reviewing files that changed from the base of the PR and between 2fce0b792ff2288822f48baa590eb318c1517a5c and 43da8447ef4cf77243d56ccb6257c9e1507da9c2.
📒 Files selected for processing (8)
-
docs/reference/classes/AsyncBatcher.mddocs/reference/classes/Batcher.mddocs/reference/functions/asyncBatch.mddocs/reference/interfaces/AsyncBatcherOptions.mddocs/reference/interfaces/BatcherOptions.mdpackages/pacer-lite/src/lite-batcher.tspackages/pacer/src/async-batcher.tspackages/pacer/src/batcher.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
-
📝 Walkthrough
-
Walkthrough#
Documentation for
Batcher,AsyncBatcher, and related APIs now describeswaitas a quiet period measured from the most recently added item. Examples clarify that reaching the batch size limit can trigger processing first.Changes#
Batch wait documentation
Layer / File(s) Summary Clarify trailing wait semantics
packages/pacer/src/batcher.ts,packages/pacer/src/async-batcher.ts,packages/pacer-lite/src/lite-batcher.ts,docs/reference/interfaces/BatcherOptions.md,docs/reference/interfaces/AsyncBatcherOptions.md,docs/reference/functions/asyncBatch.md,docs/reference/classes/Batcher.md,docs/reference/classes/AsyncBatcher.mdThe option descriptions state that each added item restarts the wait timer. Examples state that processing occurs after the quiet period or when the batch reaches five items, whichever occurs first. Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Other
Suggested reviewers:
kevinvandy
Merge Risk: ⚪ Minimal · up to
43da8The documentation clarifies when batches are processed, and no actionable merge risk is evident. The PR is ready for normal checks.
Pre-merge checks |
5-
✅ Passed checks (5 passed)
-
Check name Status Explanation Description check The description follows the repository template. It clearly explains the documentation changes, motivation, testing, checklist status, and release impact. It also states that runtime behavior is uncha… Title check The title clearly and concisely describes the main change: documenting that the wait timer restarts on every addItem call. Linked Issues check Issue #289requires documentation thatwaitmeasures quiet time after the most recentaddItem, and that examples state the last-item timing andmaxSizecondition. The source comments for `Batche…Out of Scope Changes check The diff changes only source comments and the corresponding generated reference pages. Each change documents the waitbehavior from issue#289or keeps generated documentation synchronized with thos…Docstring Coverage No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.-
MFA-G(GitHub profile, opens in a new tab) linked this to fix #289
Sign in to join this conversation.
⚠️ No Changeset found#
Latest commit: 43da8447ef4cf77243d56ccb6257c9e1507da9c2
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR