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

fix: rework optimistic indexer attempts #433

Merged
merged 4 commits into from
Nov 28, 2023
Merged

Conversation

Theodus
Copy link
Member

@Theodus Theodus commented Nov 27, 2023

The gateway was originally designed with the assumption that each indexer would likely remain about as many blocks behind chain head as when it last reported its status. However, this is no longer a valid assumption when supporting file data sources and chains with wildly inconsistent block rates. This replaces the pile of spaghetti I've created to cope with these issues with something much more straightforward. Now indexer candidates are selected based on their last reported block and the last reported block is used for the deterministic query. For each selection, under some conditions we will first make an optimistic attempt at a block 2 seconds behind chain head.

@Theodus Theodus force-pushed the theodus/indexing-status branch from b8ee423 to a9d7e3e Compare November 28, 2023 01:46
@Theodus Theodus marked this pull request as ready for review November 28, 2023 01:47
@Theodus Theodus force-pushed the theodus/indexing-status branch from a9d7e3e to 2de9e82 Compare November 28, 2023 01:48
@Theodus Theodus force-pushed the theodus/indexing-status branch from 2de9e82 to fd10161 Compare November 28, 2023 15:04
@Theodus Theodus requested a review from LNSD November 28, 2023 15:04
@Theodus Theodus changed the title fix: rework optimistic indexer attempt blocks fix: rework optimistic indexer attempts Nov 28, 2023
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

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

LGTM! ✅

@@ -935,6 +897,32 @@ pub fn indexer_fee(
}
}

async fn optimistic_query(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: A small description of this function will be very helpful for the future Theo and Lorenzo 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion. Fixed.

@Theodus Theodus force-pushed the theodus/indexing-status branch from fd10161 to b4c678e Compare November 28, 2023 15:23
@Theodus Theodus merged commit 318dd22 into main Nov 28, 2023
1 check passed
@Theodus Theodus deleted the theodus/indexing-status branch November 28, 2023 15:51
@Theodus Theodus mentioned this pull request Nov 28, 2023
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.

2 participants