refactor: reduce duplicated source code#91
Conversation
|
Warning Review limit reached
More reviews will be available in 45 minutes and 46 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR consolidates the outbox worker into a fully async-first design by converting the ChangesOutbox async-first consolidation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
|
57b1320 to
3bf85b2
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/outbox_worker/mod.rs`:
- Around line 21-31: The example shows calling OutboxClaimRef::from_message(...)
and then outbox.complete(...) without any publish step; update the snippet to
include the publish call used by the real dispatch path (i.e., invoke
publisher.publish(...).await and only call outbox.complete(&claim).await after
that publish succeeds) or replace the short example with a brief note pointing
readers to OutboxDispatcher/OutboxWorker (which perform
publisher.publish(...).await then complete) so examples do not acknowledge
messages before publishing.
In `@src/outbox_worker/worker.rs`:
- Around line 130-145: The failure path uses message.attempts compared to
self.max_attempts before counting the current failure, causing an off-by-one
extra retry; change the condition to check if message.attempts + 1 >=
self.max_attempts (or otherwise increment the attempt count before deciding) so
that when the current failure would reach max_attempts the code calls
message.fail(error_msg)? instead of message.release(error_msg) (affecting the
same branch that returns ProcessOneResult with failed/released flags).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5b8ea03f-4dea-45ea-8535-9eded29c2a86
📒 Files selected for processing (36)
README.mddocs/async-transports.mddocs/postgres-event-store.mddocs/repositories.mddocs/research-and-roadmap.mdsrc/lib.rssrc/microsvc/dependencies.rssrc/microsvc/runtime.rssrc/outbox/commit.rssrc/outbox_worker/mod.rssrc/outbox_worker/outbox_dispatch.rssrc/outbox_worker/outbox_source.rssrc/outbox_worker/publish_hook.rssrc/outbox_worker/publisher.rssrc/outbox_worker/store.rssrc/outbox_worker/worker.rssrc/postgres_repo/mod.rssrc/read_model/session.rssrc/sqlite_repo/mod.rssrc/sqlx_repo/read_model.rstests/bomberman/main.rstests/distributed_read_model/main.rstests/distributed_read_model_board/main.rstests/durable_enqueue_sqlite/main.rstests/microsvc/convention.rstests/persistent_repository_conformance/inbox.rstests/persistent_repository_conformance/outbox.rstests/postgres_repository/main.rstests/postgres_transport/main.rstests/repository_api/main.rstests/sagas/microsvc_saga.rstests/sourced_snapshot/main.rstests/sql_lock_manager/main.rstests/sqlite_repository/main.rstests/todos/main.rstests/transport_conformance/mod.rs
💤 Files with no reviewable changes (1)
- src/lib.rs
Summary
OutboxStore, and drop_asyncmethod suffixesOutboxPublisher::publish,OutboxWorker::process_message, andOutboxWorker::process_batchasyncTests
Summary by CodeRabbit
Release Notes
New Features
Documentation