You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replaced the per-item loop with try_for_each. On the first Full error, the failed item and all remaining items are collected and stored to DB atomically (std::iter::once(el).chain(iter)). Since try_send is synchronous there are no yield points between iterations, making the interleave impossible.
Breaking Changes
None
Yes — migration path described below
Test Plan
Summary by CodeRabbit
Refactor
Improved batch scheduling of intents to send more efficiently and handle channel backpressure by persisting remaining bundles when needed.
Documentation
Clarified database docstring describing retrieval of the oldest (first stored) intent bundle.
The PR refactors the IntentExecutionManager::schedule method to batch multiple overflowing intents into a single database persist operation. Previously, the method would iterate through intents with try_send and immediately persist only the first overflowing item. The updated implementation uses try_for_each to collect the current overflowing element plus all remaining intents into a leftovers vector, then persists the entire batch to the database via store_intent_bundles. A documentation clarification in the DB trait specifies that the "pop oldest intent bundle" operation returns the oldest (first stored) item rather than the one with the smallest id.
Suggested reviewers
snawaz
GabrielePicco
✨ Finishing Touches🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch fix/intent-execution-manager
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.
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
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.
Summary
Replaced the per-item loop with try_for_each. On the first
Fullerror, the failed item and all remaining items are collected and stored to DB atomically (std::iter::once(el).chain(iter)). Since try_send is synchronous there are no yield points between iterations, making the interleave impossible.Breaking Changes
Test Plan
Summary by CodeRabbit
Refactor
Documentation