Collapse nested conditionals#253
Conversation
Reviewer's GuideThis PR reduces nested conditionals in push queue rate validation by using Option.filter, restructures preamble callback error handling to a match construct that logs failures without halting processing, and updates formatting of trivial methods to multi-line bodies for consistency. Sequence diagram for simplified preamble callback error handlingsequenceDiagram
participant Server
participant Stream
participant Handler
Server->>Stream: read_preamble()
alt read_preamble Ok
Server->>Handler: handler(&preamble, &mut stream).await
alt Handler returns Ok
Note right of Server: Continue processing
else Handler returns Err(e)
Server->>Server: Log error (tracing::error)
Note right of Server: Continue processing
end
Server->>Stream: RewindStream::new(leftover, stream)
else read_preamble Err
Note right of Server: Handle error (not shown)
end
Class diagram for PushQueues rate validation logic updateclassDiagram
class PushQueues {
+new(high_capacity, low_capacity, rate, dlq) Result<(Self, PushHandle<F>), PushConfigError>
}
class PushConfigError {
+InvalidRate(usize)
}
PushQueues "1" -- "1" PushConfigError : returns error on invalid rate
class PushHandle {
+from_arc(arc: Arc<PushHandleInner<F>>) -> Self
+downgrade(&self) -> Weak<PushHandleInner<F>>
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes and found some issues that need to be addressed.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
* Replace unwraps with expect * Add expect macros and document infallible call * Use push_expect macros in connection actor tests Replace verbose await/expect pairs with the push_expect! helper to standardise low- and high-priority push failure messages. Rewriting let-chain expressions to nested conditionals keeps the build on stable Rust, and lint expectations were relaxed accordingly. * Apply formatting * Handle low queue TryRecvError and fix test message (#252) * Handle missing TryRecvError and fix test message * Apply formatting * Collapse nested conditionals (#253) * Remove unneedeed carriage returns * Remove unneedeed carriage returns * Remove unused struct * Remove unused struct
Summary
ifin push queuesTesting
make fmtmake lintmake testhttps://chatgpt.com/codex/tasks/task_e_688f6fa4c4e083229cd17b9c36880b3e
Summary by Sourcery
Refactor conditional logic and simplify error handling to improve readability and maintainability
Enhancements: