p2p: add channel buffers to avoid goroutine leaks in tests (#24929)

This commit is contained in:
Boqin@MetaSecureLabs
2022-09-23 10:51:12 +02:00
committed by GitHub
parent 220bdd3277
commit e6d4aedb8c
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ const (
func (p *pingPongService) Run(peer *p2p.Peer, rw p2p.MsgReadWriter) error {
log := p.log.New("peer.id", peer.ID())
errC := make(chan error)
errC := make(chan error, 1)
go func() {
for range time.Tick(10 * time.Second) {
log.Info("sending ping")
+1 -1
View File
@@ -596,7 +596,7 @@ func TestHTTPSnapshot(t *testing.T) {
network, s := testHTTPServer(t)
defer s.Close()
var eventsDone = make(chan struct{})
var eventsDone = make(chan struct{}, 1)
count := 1
eventsDoneChan := make(chan *Event)
eventSub := network.Events().Subscribe(eventsDoneChan)