Skip to content

Commit

Permalink
Merge pull request #126 from poanetwork/reduce-amount-calls
Browse files Browse the repository at this point in the history
Update intervals timeout
  • Loading branch information
rstormsf authored Jul 10, 2018
2 parents 477c068 + 7327c3d commit f598fe6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/stores/ForeignStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ForeignStore {
this.getEvents()
this.getTokenBalance()
this.getCurrentLimit()
}, 5000)
}, 15000)
}

@action
Expand Down
4 changes: 3 additions & 1 deletion src/stores/HomeStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ class HomeStore {
setInterval(() => {
this.getEvents()
this.getBalance()
this.getCurrentLimit()
this.getBlockNumber()
}, 5000)
setInterval(() => {
this.getCurrentLimit()
}, 10000)
}

@action
Expand Down
5 changes: 2 additions & 3 deletions src/stores/Web3Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import swal from 'sweetalert'

class Web3Store {
@observable injectedWeb3 = {};
@observable defaultAccount = {address: '', homeBalance: '', foreignBalance: ''};
@observable defaultAccount = {address: '', homeBalance: ''};

@observable homeWeb3 = {};
@observable foreignWeb3 = {};
Expand All @@ -32,7 +32,7 @@ class Web3Store {
this.getBalances(false)
setInterval(() => {
this.getBalances(true)
}, 1000)
}, 3000)
}).catch((e) => {
console.error(e,'web3 not loaded')
this.errors.push(e.message)
Expand Down Expand Up @@ -79,7 +79,6 @@ class Web3Store {
this.defaultAccount.address = accounts[0]
}
this.defaultAccount.homeBalance = await getBalance(this.homeWeb3, this.defaultAccount.address)
this.defaultAccount.foreignBalance = await getBalance(this.foreignWeb3, this.defaultAccount.address)
if(accountUpdated) {
await this.rootStore.foreignStore.getTokenBalance()
this.alertStore.setLoading(false)
Expand Down

0 comments on commit f598fe6

Please sign in to comment.