Explorar el Código

etcdserver/stats: make all fields guarded by mutex.

disksing hace 7 años
padre
commit
095fc0b411
Se han modificado 1 ficheros con 1 adiciones y 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 {