[ISSUE #1698]🚀EscapeBridge supports asyncPutMessage#1713
[ISSUE #1698]🚀EscapeBridge supports asyncPutMessage#1713rocketmq-rust-bot merged 1 commit intomainfrom
Conversation
WalkthroughThe changes introduce a new asynchronous method Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
|
🔊@mxsm 🚀Thanks for your contribution 🎉. CodeRabbit(AI) will review your code first 🔥 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1713 +/- ##
==========================================
- Coverage 27.90% 27.89% -0.02%
==========================================
Files 473 473
Lines 63838 63879 +41
==========================================
Hits 17816 17816
- Misses 46022 46063 +41 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
rocketmq-broker/src/failover/escape_bridge.rs (3)
220-263: Refactor to reduce code duplication betweenasync_put_messageandput_messageThe logic in
async_put_messageshares similarities with the existingput_messagemethod. Refactoring common code into shared helper functions can improve maintainability and reduce duplication.Consider extracting shared logic into a private helper method. This will make future updates easier and reduce the chance of inconsistencies between the two methods.
234-236: Add logging when topic publish info is unavailableReturning
ServiceNotAvailablewithout logging may make it harder to diagnose issues whentopic_publish_infoisNone. Adding a warning log can help with debugging.Apply this diff to add logging:
if topic_publish_info.is_none() { + warn!( + "async_put_message: no route info for topic {}", + message_ext.get_topic() + ); return PutMessageResult::new_default(PutMessageStatus::ServiceNotAvailable); }
239-241: Add logging when no message queue is selectedWhen
mq_selectedisNone, logging this condition can assist in identifying routing problems.Apply this diff to add logging:
if mq_selected.is_none() { + warn!( + "async_put_message: no message queue available for topic {}", + message_ext.get_topic() + ); return PutMessageResult::new_default(PutMessageStatus::ServiceNotAvailable); }
| let broker_addr_to_send = self | ||
| .topic_route_info_manager | ||
| .find_broker_address_in_publish(Some(broker_name_to_send)); | ||
| let producer_group = self.get_producer_group(&message_ext); | ||
| let result = self | ||
| .broker_outer_api | ||
| .send_message_to_specific_broker( | ||
| broker_addr_to_send.as_ref().unwrap(), |
There was a problem hiding this comment.
Prevent potential panic by handling None value of broker_addr_to_send
Currently, broker_addr_to_send might be None, and unwrapping it without prior checking could cause a panic. Before unwrapping, check if broker_addr_to_send is Some and handle the None case appropriately.
Apply this diff to handle the None value:
+ if broker_addr_to_send.is_none() {
+ warn!(
+ "async_put_message: broker address not found for broker {}",
+ broker_name_to_send
+ );
+ return PutMessageResult::new_default(PutMessageStatus::ServiceNotAvailable);
+ }
let result = self
.broker_outer_api
.send_message_to_specific_broker(
- broker_addr_to_send.as_ref().unwrap(),
+ broker_addr_to_send.as_ref().unwrap(),
broker_name_to_send,
message_ext.message_ext_inner,
producer_group,
SEND_TIMEOUT,
)
.await;Committable suggestion skipped: line range outside the PR's diff.
Which Issue(s) This PR Fixes(Closes)
Fixes #1698
Brief Description
How Did You Test This Change?
Summary by CodeRabbit