Browse Source

etcdserver/stats: make all fields guarded by mutex.

disksing 7 years ago
parent
commit
095fc0b411
1 changed files with 1 additions and 1 deletions
  1. 1 1
      etcdserver/stats/server.go

+ 1 - 1
etcdserver/stats/server.go

@@ -76,8 +76,8 @@ func (ss *ServerStats) JSON() []byte {
 	stats := ss.serverStats
 	stats.SendingPkgRate, stats.SendingBandwidthRate = stats.sendRateQueue.Rate()
 	stats.RecvingPkgRate, stats.RecvingBandwidthRate = stats.recvRateQueue.Rate()
-	ss.Unlock()
 	stats.LeaderInfo.Uptime = time.Since(stats.LeaderInfo.StartTime).String()
+	ss.Unlock()
 	b, err := json.Marshal(stats)
 	// TODO(jonboulle): appropriate error handling?
 	if err != nil {