refactor: run initial peer connect async

This commit is contained in:
Derrick Hammer 2024-01-10 07:42:04 -05:00
parent 6591b2a79f
commit 123f28ac19
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 4 deletions

View File

@ -78,10 +78,14 @@ func (p *P2PImpl) Start() error {
if err != nil {
return err
}
err = p.ConnectToNode([]*url.URL{u}, false)
peer := peer
go func() {
err := p.ConnectToNode([]*url.URL{u}, false)
if err != nil {
return err
p.logger.Error("failed to connect to initial peer", zap.Error(err), zap.String("peer", peer))
}
}()
}
}