Skip to content

Commit

Permalink
Merge pull request #9562 from disksing/data-race
Browse files Browse the repository at this point in the history
etcdserver/stats: fix stats data race.
  • Loading branch information
gyuho committed Apr 12, 2018
2 parents 2c1840c + 10bf028 commit 836fffa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions etcdserver/stats/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ type serverStats struct {
func (ss *ServerStats) JSON() []byte {
ss.Lock()
stats := ss.serverStats
ss.Unlock()
stats.LeaderInfo.Uptime = time.Since(stats.LeaderInfo.StartTime).String()
stats.SendingPkgRate, stats.SendingBandwidthRate = stats.sendRateQueue.Rate()
stats.RecvingPkgRate, stats.RecvingBandwidthRate = stats.recvRateQueue.Rate()
stats.LeaderInfo.Uptime = time.Since(stats.LeaderInfo.StartTime).String()
ss.Unlock()
b, err := json.Marshal(stats)
// TODO(jonboulle): appropriate error handling?
if err != nil {
Expand Down

0 comments on commit 836fffa

Please sign in to comment.