-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #1811]🤡Implement DefaultMQPushConsumerImpl#process_pop_result method function🚀 #1814
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1471,7 +1471,7 @@ | |||||||||||||||
}; | ||||||||||||||||
let mut pop_result = PopResult { | ||||||||||||||||
pop_status, | ||||||||||||||||
msg_found_list, | ||||||||||||||||
msg_found_list: Some(msg_found_list), | ||||||||||||||||
..Default::default() | ||||||||||||||||
}; | ||||||||||||||||
let response_header = response | ||||||||||||||||
|
@@ -1506,9 +1506,16 @@ | |||||||||||||||
.unwrap_or(&CheetahString::from_slice("")), | ||||||||||||||||
) | ||||||||||||||||
.map_err(RemotingError)?; | ||||||||||||||||
let sort_map = build_queue_offset_sorted_map(topic.as_str(), &pop_result.msg_found_list); | ||||||||||||||||
let sort_map = build_queue_offset_sorted_map( | ||||||||||||||||
topic.as_str(), | ||||||||||||||||
pop_result.msg_found_list.as_ref().map_or(&[], |v| v), | ||||||||||||||||
); | ||||||||||||||||
let mut map = HashMap::with_capacity(5); | ||||||||||||||||
for message in &mut pop_result.msg_found_list { | ||||||||||||||||
for message in pop_result | ||||||||||||||||
.msg_found_list | ||||||||||||||||
.as_mut() | ||||||||||||||||
.map_or(&mut vec![], |v| v) | ||||||||||||||||
{ | ||||||||||||||||
Comment on lines
+1514
to
+1518
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix mutable reference to temporary value in loop over Creating a mutable reference to a temporary value using Apply this diff to correct the loop: - for message in pop_result
- .msg_found_list
- .as_mut()
- .map_or(&mut vec![], |v| v)
- {
+ if let Some(messages) = pop_result.msg_found_list.as_mut() {
+ for message in messages {
+ // Process each message
+ }
+ } This ensures that you only iterate over the messages if 📝 Committable suggestion
Suggested change
|
||||||||||||||||
if start_offset_info.is_empty() { | ||||||||||||||||
let key = CheetahString::from_string(format!( | ||||||||||||||||
"{}{}", | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Include messages without tags during tag filtering if appropriate.
In the tag filtering logic, messages without tags are currently being excluded because
msg.get_tags()
returnsNone
. If it is intended to process messages without tags when the subscription has tag filters, consider modifying the logic to include these messages. This ensures no valid messages are unintentionally skipped.Apply this diff to include messages without tags when applicable: