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

RPC fallback final touches #467

Open
wants to merge 3 commits into
base: dz/fallback-rpc-2
Choose a base branch
from
Open

Conversation

DZakh
Copy link
Member

@DZakh DZakh commented Mar 7, 2025

  • Display rpc host in the source name
  • Stop using Ethers.js for Height checks
  • Prevent exit when fallback fails

todo: write tests

@DZakh DZakh requested a review from JonoPrest March 7, 2025 15:32
Comment on lines +307 to +331
| Source.GetItemsError(error) => {
// TODO: When we start handling fetch failures,
// we shouldn't delete the source from the set
// but keep it for retries. Still need to delete
// for cases like UnsupportedSelection which are
// not retryable
let notAlreadyDeleted = sourceManager.sources->Utils.Set.delete(source)

// In case there are multiple partitions
// failing at the same time. Log only once
if notAlreadyDeleted {
switch error {
| UnsupportedSelection({message}) => logger->Logging.childError(message)
| FailedGettingFieldSelection({message, blockNumber, logIndex})
| FailedParsingItems({message, blockNumber, logIndex}) =>
logger->Logging.childError({
"msg": message,
"blockNumber": blockNumber,
"logIndex": logIndex,
})
}
}

switch sourceManager->getNextActiveSource {
| None => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not the most robust logic, and can be improved in the future. But currently it only applies to RPC data-sources and good enough to prevent Fallback sources from killing the indexer when there are still other sources.

}
}
// TODO: Handle more error cases and hang/retry instead of throwing
| exn => exn->ErrorHandling.mkLogAndRaise(~logger, ~msg="Failed to fetch block Range")
Copy link
Member Author

Choose a reason for hiding this comment

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

HyperSync will fail as before

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I catch it and dispatchAction(ErrorExit(errHandler)) or simply throwing is fine?

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.

1 participant