Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions rocketmq-namesrv/src/route/route_info_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,10 @@ impl RouteInfoManager {
// Acquire read lock
let lock = self.lock.read();
if let Some(queue_data_map) = self.topic_queue_table.get(topic) {
topic_route_data.queue_datas = queue_data_map.values().cloned().collect();
topic_route_data
.queue_datas
.extend(queue_data_map.values().cloned().collect::<Vec<_>>());
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intermediate Vec collection is unnecessary. Use .extend(queue_data_map.values().cloned()) directly instead of collecting into a Vec first, which eliminates an extra allocation and improves performance.

Suggested change
.extend(queue_data_map.values().cloned().collect::<Vec<_>>());
.extend(queue_data_map.values().cloned());

Copilot uses AI. Check for mistakes.


found_queue_data = true;

for broker_name in queue_data_map.keys() {
Expand Down Expand Up @@ -511,9 +514,8 @@ impl RouteInfoManager {
for queue_data in &topic_route_data.queue_datas {
if queue_data.broker_name() == broker_data.broker_name() {
if !PermName::is_writeable(queue_data.perm()) {
if let Some(min_broker_id) =
broker_data.broker_addrs().keys().cloned().min()
{
if let Some(min_broker_id) = broker_data.broker_addrs().keys().min() {
let min_broker_id = *min_broker_id;
if let Some(acting_master_addr) =
broker_data.broker_addrs_mut().remove(&min_broker_id)
{
Expand Down
Loading