Skip to content

Commit

Permalink
Merge pull request #668 from eco-stake/autostake-reset-config-each-ne…
Browse files Browse the repository at this point in the history
…twork

Ensure config resets when running for multi chains
  • Loading branch information
tombeynon authored Nov 3, 2022
2 parents 5c93b42 + fbdf267 commit 9490bdb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/autostake/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default function Autostake(mnemonic, opts) {

async function getNetworkRunner(data) {
const network = new Network(data)
let config = { ...opts }
try {
await network.load()
} catch {
Expand All @@ -132,7 +133,7 @@ export default function Autostake(mnemonic, opts) {

if (!network.authzSupport) return timeStamp('No Authz support')

await network.connect({ timeout: opts.delegationsTimeout || 20000 })
await network.connect({ timeout: config.delegationsTimeout || 20000 })

const { restUrl, usingDirectory } = network

Expand All @@ -143,7 +144,7 @@ export default function Autostake(mnemonic, opts) {
if (usingDirectory) {
timeStamp('You are using public nodes, they may not be reliable. Check the README to use your own')
timeStamp('Delaying briefly and adjusting config to reduce load...')
opts = {...opts, batchPageSize: 50, batchQueries: 10, queryThrottle: 2500}
config = {...config, batchPageSize: 50, batchQueries: 10, queryThrottle: 2500}
await new Promise(r => setTimeout(r, (Math.random() * 31) * 1000));
}

Expand All @@ -154,7 +155,7 @@ export default function Autostake(mnemonic, opts) {
network,
operator,
signingClient,
opts
config
)
}

Expand Down

0 comments on commit 9490bdb

Please sign in to comment.