Skip to content
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

handle errors in getLatestBlock #1649

Merged
merged 2 commits into from
Apr 30, 2020
Merged

handle errors in getLatestBlock #1649

merged 2 commits into from
Apr 30, 2020

Conversation

dkent600
Copy link
Contributor

@dkent600 dkent600 commented Apr 30, 2020

Resolves: #1648

Mainly to the error: "connection not open on send()" in web3.eth.getBlock("latest")

See: web3/web3.js#1354

Copy link
Contributor

@tibetsprague tibetsprague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to be clear this doesn't solve the issue of the subgraph not syncing error because if we return null then we will display that message. which is probably a correct message to show?

@dkent600
Copy link
Contributor Author

@tibetsprague

just to be clear this doesn't solve the issue of the subgraph not syncing error because if we return null then we will display that message. which is probably a correct message to show?

When we return null the entire iteration is aborted. We do nothing. (This is commented in the code)

@@ -126,7 +134,7 @@ export async function initializeArc(provider?: any): Promise<boolean> {
const retryLink = new RetryLink({
attempts: {
max: 5,
retryIf: (error, _operation) => {
retryIf: (error, _operation) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change ? how the linter did not catch that before..is it catching that at all?
if linter does not care about so leave these update for other "lint": pr.. it is difficult to review with all these changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. On this github page you can tell the github to ignore whitespage differences
  2. I already created a separate PR to make the linter catch these: lint: eliminate redundant multiple spaces #1650

const curBlock = (await getCurrentBlock()).number;
const curBlock = (await getCurrentBlock())?.number;
if (curBlock === undefined) {
return; // try again next time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log something to the console..here?

Copy link
Contributor Author

@dkent600 dkent600 Apr 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (in getCurrentBlock)

@dkent600 dkent600 temporarily deployed to alchemy-morerobustgetla-je27jn April 30, 2020 17:52 Inactive
@dkent600 dkent600 merged commit ceb5fe2 into dev Apr 30, 2020
@dkent600 dkent600 deleted the moreRobustGetLatestBlock branch April 30, 2020 17:55
@dkent600 dkent600 restored the moreRobustGetLatestBlock branch April 30, 2020 17:57
@dkent600 dkent600 deleted the moreRobustGetLatestBlock branch April 30, 2020 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check getCurrentBlock return value validity
3 participants