Skip to content

Commit

Permalink
Increase needsLoop interval to fix performance regression
Browse files Browse the repository at this point in the history
  • Loading branch information
samholmes committed Nov 8, 2024
1 parent 4f971f3 commit 01ec9c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- fixed: (EVM) Fix performance regression caused by thrashing on network queries.

## 4.27.0 (2024-10-31)

- added: Add Toncoin (TON)
Expand Down
13 changes: 9 additions & 4 deletions src/ethereum/EthereumNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from './networkAdapters/types'

const BLOCKHEIGHT_POLL_MILLISECONDS = getRandomDelayMs(20000)
const NEEDS_LOOP_INTERVAL = 20000
const NONCE_POLL_MILLISECONDS = getRandomDelayMs(20000)
const BAL_POLL_MILLISECONDS = getRandomDelayMs(20000)
const TXS_POLL_MILLISECONDS = getRandomDelayMs(20000)
Expand Down Expand Up @@ -162,11 +163,15 @@ export class EthereumNetwork {
tokenBalLastChecked: {},
tokenTxsLastChecked: {}
}
this.needsLoopTask = makePeriodicTask(this.needsLoop.bind(this), 1000, {
onError: error => {
this.ethEngine.log.warn('needsLoopTask error:', error)
this.needsLoopTask = makePeriodicTask(
this.needsLoop.bind(this),
NEEDS_LOOP_INTERVAL,
{
onError: error => {
this.ethEngine.log.warn('needsLoopTask error:', error)
}
}
})
)
this.networkAdapters = this.buildNetworkAdapters(this.ethEngine.networkInfo)
this.walletId = ethEngine.walletInfo.id
}
Expand Down

0 comments on commit 01ec9c3

Please sign in to comment.