From f6e5a6ea439577e14bb00a3c86abeffd19eff692 Mon Sep 17 00:00:00 2001 From: Zach Badgett Date: Thu, 31 Dec 2015 10:02:44 -0700 Subject: [PATCH] nsqd: moved runlock in GetStats --- nsqd/stats.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nsqd/stats.go b/nsqd/stats.go index 3c61db2c4..daf792d72 100644 --- a/nsqd/stats.go +++ b/nsqd/stats.go @@ -117,8 +117,6 @@ func (c ChannelsByName) Less(i, j int) bool { return c.Channels[i].name < c.Chan func (n *NSQD) GetStats() []TopicStats { n.RLock() - defer n.RUnlock() - realTopics := make([]*Topic, 0, len(n.topicMap)) for _, t := range n.topicMap { realTopics = append(realTopics, t) @@ -126,6 +124,7 @@ func (n *NSQD) GetStats() []TopicStats { sort.Sort(TopicsByName{realTopics}) topics := make([]TopicStats, 0, len(n.topicMap)) + n.RUnlock() for _, t := range realTopics { t.RLock()