nsqio/nsq

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

开放

#1,492 创建于 2024年7月5日

 (1 条评论) (0 个反应) (0 位负责人)Go (2,898 个派生)batch import
bughelp wanted

仓库指标

星标
 (25,788 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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?**
}

贡献者指南