fixed data race finally....

This commit is contained in:
Jeffrey Picard 2022-11-04 01:40:43 +00:00
parent d90a968afc
commit ec719e33fa
2 changed files with 2 additions and 2 deletions

View file

@ -374,7 +374,7 @@ func (s *Server) addPeer(newPeer *Peer, ping bool, subscribe bool) error {
// This is weird because we're doing grpc and jsonrpc here. // This is weird because we're doing grpc and jsonrpc here.
// Do we still want to custom grpc? // Do we still want to custom grpc?
log.Warn("Sending peer to NotifierChan") log.Warn("Sending peer to NotifierChan")
s.NotifierChan <- newPeer s.NotifierChan <- peerNotification{newPeer.Address, newPeer.Port}
// Subscribe to all our peers for now // Subscribe to all our peers for now
if subscribe { if subscribe {

View file

@ -93,7 +93,6 @@ func TestAddPeer(t *testing.T) {
log.Println(err) log.Println(err)
} }
} }
hubServer.Stop()
var m = &dto.Metric{} var m = &dto.Metric{}
if err := metrics.PeersKnown.Write(m); err != nil { if err := metrics.PeersKnown.Write(m); err != nil {
t.Errorf("Error getting metrics %+v\n", err) t.Errorf("Error getting metrics %+v\n", err)
@ -102,6 +101,7 @@ func TestAddPeer(t *testing.T) {
if got != tt.want { if got != tt.want {
t.Errorf("len(server.PeerServers) = %d, want %d\n", got, tt.want) t.Errorf("len(server.PeerServers) = %d, want %d\n", got, tt.want)
} }
hubServer.Stop()
}) })
} }