Skip to content

Commit

Permalink
updates nodeStorageActions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
comountainclimber committed Nov 13, 2018
1 parent fba836d commit 800d415
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/actions/nodeStorageActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ export const getRPCEndpoint = async (
const goodNodes = nodes.filter(
n => n.client.lastSeenHeight >= heightThreshold
)
const randomlySelectedRPCUrl =
goodNodes[random(goodNodes.length) - 1].client.net
let randomIndex = random(goodNodes.length)
if (randomIndex === goodNodes.length) {
// eslint-disable-next-line
randomIndex--
}
const randomlySelectedRPCUrl = goodNodes[randomIndex].client.net
cachedRPCUrl[net] = randomlySelectedRPCUrl
return randomlySelectedRPCUrl
} catch (error) {
Expand Down

0 comments on commit 800d415

Please sign in to comment.