-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recent-blocks - dont listen for block when on infura providers #6124
Conversation
20dd7ae
to
30f25a6
Compare
30f25a6
to
7e64a57
Compare
try { | ||
await this.processBlock(newBlockNumberHex) | ||
} catch (err) { | ||
log.error(err) | ||
} | ||
} | ||
let isListeng = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo, should be isListening
isListeng = true | ||
} | ||
networkController.on('networkDidChange', (newType) => { | ||
if (INFURA_PROVIDER_TYPES.includes(newType) && isListeng) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (INFURA_PROVIDER_TYPES.includes(newType) && isListeng) { | |
if (INFURA_PROVIDER_TYPES.includes(newType) && isListening) { |
try { | ||
await this.processBlock(newBlockNumberHex) | ||
} catch (err) { | ||
log.error(err) | ||
} | ||
} | ||
let isListeng = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let isListeng = false | |
let isListening = false |
} else if ( | ||
!INFURA_PROVIDER_TYPES.includes(type) && | ||
type !== 'loading' && | ||
!isListeng |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!isListeng | |
!isListening |
237f859
to
c10fb3c
Compare
Typo isListeng
has been changed to isListening
this will remove the listener off the block tracker when on infura providers sense it is not needed
that will allow the block tracker to stop polling