Explorar o código

etcdserver/stats: make all fields guarded by mutex.

disksing %!s(int64=7) %!d(string=hai) anos
pai
achega
10bf0283be
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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 {