From e0ac1b2ceff864b9b81605a09db52eecd53dd331 Mon Sep 17 00:00:00 2001 From: Matt Reiferson Date: Thu, 7 Jan 2016 15:59:44 -0800 Subject: [PATCH] nsqd: fix stats data race --- nsqd/stats.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nsqd/stats.go b/nsqd/stats.go index 40934683b..81c1c03e6 100644 --- a/nsqd/stats.go +++ b/nsqd/stats.go @@ -123,7 +123,7 @@ func (n *NSQD) GetStats() []TopicStats { } n.RUnlock() sort.Sort(TopicsByName{realTopics}) - topics := make([]TopicStats, 0, len(n.topicMap)) + topics := make([]TopicStats, 0, len(realTopics)) for _, t := range realTopics { t.RLock() realChannels := make([]*Channel, 0, len(t.channelMap)) @@ -132,7 +132,7 @@ func (n *NSQD) GetStats() []TopicStats { } t.RUnlock() sort.Sort(ChannelsByName{realChannels}) - channels := make([]ChannelStats, 0, len(t.channelMap)) + channels := make([]ChannelStats, 0, len(realChannels)) for _, c := range realChannels { c.RLock() clients := make([]ClientStats, 0, len(c.clients))