Skip to content

Commit

Permalink
Add a try/catch in nodesync around peering with primary node's IPFS (#…
Browse files Browse the repository at this point in the history
…1293)

* Add try catches around ipfs peering in nodesync

* Better comment

* Better log

* Code review fixes
  • Loading branch information
dmanjunath committed Mar 11, 2021
1 parent ceaebcc commit 6590350
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions creator-node/src/routes/nodeSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,15 @@ async function _nodesync (req, walletPublicKeys, creatorNodeEndpoint) {

req.logger.info(redisKey, `Successful export from ${creatorNodeEndpoint} for wallets ${walletPublicKeys} and requested min clock ${localMaxClockVal + 1}`)

// Attempt to connect directly to target CNode's IPFS node.
await _initBootstrapAndRefreshPeers(req, body.data.ipfsIDObj.addresses, redisKey)
req.logger.info(redisKey, 'IPFS Nodes connected + data export received')
try {
// Attempt to connect directly to target CNode's IPFS node.
await _initBootstrapAndRefreshPeers(req, body.data.ipfsIDObj.addresses, redisKey)
req.logger.info(redisKey, 'IPFS Nodes connected + data export received')
} catch (e) {
// if there's an error peering to an IPFS node, do not stop execution
// since we have other fallbacks, keep going on with sync
req.logger.error(`Error in _nodeSync calling _initBootstrapAndRefreshPeers for redisKey ${redisKey}`, e)
}

/**
* For each CNodeUser, replace local DB state with retrieved data + fetch + save missing files.
Expand Down

0 comments on commit 6590350

Please sign in to comment.