Skip to content

Commit

Permalink
Merge #1138
Browse files Browse the repository at this point in the history
1138: skip connecting to invalid identities in the identity table and log error instead of fatal r=vishalchangrani a=vishalchangrani

Found one more place where it was `log.fatal` on a bad identity.


Co-authored-by: Vishal <1117327+vishalchangrani@users.noreply.github.com>
  • Loading branch information
bors[bot] and vishalchangrani committed Aug 19, 2021
2 parents e74ecca + c5abe58 commit 85dc4a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion network/p2p/libp2pConnector.go
Expand Up @@ -42,7 +42,7 @@ func (e UnconvertibleIdentitiesError) Error() string {
for id, err := range e.errs {
multierr = multierror.Append(multierr, fmt.Errorf("failed to connect to %s: %w", id.String(), err))
}
return multierr.GoString()
return multierr.Error()
}

// IsUnconvertibleIdentitiesError returns whether the given error is an UnconvertibleIdentitiesError error
Expand Down
13 changes: 3 additions & 10 deletions network/p2p/peerManager.go
Expand Up @@ -118,15 +118,8 @@ func (pm *PeerManager) updatePeers() {

// ask the connector to connect to all peers in the list
err = pm.connector.UpdatePeers(pm.unit.Ctx(), ids)
if err == nil {
return
}

if IsUnconvertibleIdentitiesError(err) {
// log conversion error as fatal since it indicates a bad identity table
pm.logger.Fatal().Err(err).Msg("failed to connect to peers")
return
if err != nil {
// one of more identities in the identity table could not be connected to
pm.logger.Error().Err(err).Msg("failed to connect to one or more peers")
}

pm.logger.Error().Err(err).Msg("failed to connect to peers")
}

0 comments on commit 85dc4a6

Please sign in to comment.