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

nsqd: statistics aren't recorded when client publishes to multiple topics #1492

Open
zhaohaihang opened this issue Jul 5, 2024 · 1 comment · May be fixed by #1497
Open

nsqd: statistics aren't recorded when client publishes to multiple topics #1492

zhaohaihang opened this issue Jul 5, 2024 · 1 comment · May be fixed by #1497

Comments

@zhaohaihang
Copy link

zhaohaihang commented Jul 5, 2024

When a client sends messages to multiple topics, the statistics information can only output the results of one topic for a single client. After reviewing the code, I found that the problem lies in the break statement on line 305 of the client_v2.go file. Can you explain why this break statement is added?

for topic, count := range c.pubCounts {
	if len(topicName) > 0 && topic != topicName {
		continue
	}
	pubCounts = append(pubCounts, PubCount{
		Topic: topic,
		Count: count,
	})
	break   **//  What does this break statement do?**
}
@mreiferson
Copy link
Member

I think you're correct that it's a bug, we probably never considered that the protocol allowed a single client to publish to multiple topics.

@mreiferson mreiferson changed the title There is an error in the statistics information nsqd: statistics aren't recorded when client publishes to multiple topics Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants