Repository navigation
use Batch Worker - #211
use Batch Worker#211
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
commit: |
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: get-convex/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (23)
📝 WalkthroughWalkthroughThis change migrates workpool loop scheduling to Sequence Diagram(s)sequenceDiagram
participant Producer
participant Workpool
participant BatchWorker
participant WorkpoolDB
Producer->>Workpool: enqueue, complete, cancel, or retry
Workpool->>BatchWorker: ping main worker
BatchWorker->>Workpool: call getBatch
Workpool->>WorkpoolDB: read pending queues and state
Workpool-->>BatchWorker: return work or idle batch
BatchWorker->>Workpool: call run for work batch
Workpool->>WorkpoolDB: process items and persist state
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
| completed.map(async (c) => { | ||
| // Guard: getBatch and main run in separate transactions, so defend | ||
| // against a doc that was already processed/removed. | ||
| if (!(await ctx.db.get("pendingCompletion", c._id))) { |
There was a problem hiding this comment.
I think the guard here is good, but I'm curious if this scenario is ever possible in theory (besides cases where users directly modify the data)? run is the only function that modifies pendingCompletion and it does not run concurrently
There was a problem hiding this comment.
Yeah this is overly cautious
| }); | ||
|
|
||
| it("transitions to scheduled (saturated=false) when only future-scheduled work remains", async () => { | ||
| it("idles with a timeoutMs when only future-scheduled work remains", async () => { |
There was a problem hiding this comment.
should we also test that timeoutMs is the difference until the next recovery segment if that is closer than future work?
| }); | ||
| // A pre-migration scheduled call lands here after deploy. It just pings | ||
| // batch-worker (no-op in tests) and must not throw. | ||
| await t.mutation(internal.loop.main, { generation: 1n, segment: 123n }); |
There was a problem hiding this comment.
hmm i think this just tests that main does not throw and not necessarily that it resumes the loop
039fa52 to
82a0d4f
Compare
fcd476b to
def56cc
Compare

use Batch Worker