cluster: change lock from Read lock to Write Lock since function modifies the struct... (#2109)

Signed-off-by: John Smith <megman5576@gmail.com>
This commit is contained in:
Pger-Y 2019-11-21 21:15:58 +08:00 committed by Simon Pasquier
parent 26cc96a787
commit f76fec1fd9
1 changed files with 2 additions and 2 deletions

View File

@ -260,8 +260,8 @@ func (p *Peer) setInitialFailed(peers []string, myAddr string) {
return return
} }
p.peerLock.RLock() p.peerLock.Lock()
defer p.peerLock.RUnlock() defer p.peerLock.Unlock()
now := time.Now() now := time.Now()
for _, peerAddr := range peers { for _, peerAddr := range peers {