Skip to content
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

Remove duplicate code in TopicPublishInfo #6398

Open
zyx333 opened this issue Mar 19, 2023 · 8 comments
Open

Remove duplicate code in TopicPublishInfo #6398

zyx333 opened this issue Mar 19, 2023 · 8 comments
Labels
Good First Issue Good First Issue

Comments

@zyx333
Copy link
Contributor

zyx333 commented Mar 19, 2023

The code block below in the selectOneMessageQueue method is identical to another overloaded method (2nd code block).

int index = this.sendWhichQueue.incrementAndGet();
int pos = index % this.messageQueueList.size();
MessageQueue mq = this.messageQueueList.get(pos);

public MessageQueue selectOneMessageQueue() {
int index = this.sendWhichQueue.incrementAndGet();
int pos = index % this.messageQueueList.size();
return this.messageQueueList.get(pos);
}

IMO, it can be rewritten like this.

for (int i = 0; i < this.messageQueueList.size(); i++) {
         MessageQueue mq = selectOneMessageQueue()
         if (!mq.getBrokerName().equals(lastBrokerName)) {
               return mq;
         }
 }

If it's acceptable, I will submit a pull request.

@Oliverwqcwrw
Copy link
Member

IMO, It's a good idea, welcome your PR :-)

@AdityaP7649
Copy link

Hi there! I'm interested in working on this issue. It aligns with my skills. Could you please assign this issue to me, or guide me on how to get started? Thanks!

@benedikt-roth
Copy link

@Oliverwqcwrw I would like to work on this in case it is not picked up yet.

@farukhfrk
Copy link

I would like to work on this, Could you please assign it to me?

@ThestralWarrior
Copy link

i see this hasn't been assigned yet, can I work on this?

@bitWizrd
Copy link

bitWizrd commented Jan 6, 2024

@Oliverwqcwrw Kindly to ask if there is somebody working for this issue? lf not, I'm glad to undertake it.

@Oliverwqcwrw
Copy link
Member

Thank you very much for your attention to the community, I noticed that the latest code has changed, please take a look at the latest code to check whether the problem still exists :)

@ling0900
Copy link

Is it possible for this issue to be closed in the near future? If not, I'll try to follow up on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good First Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants