-
Notifications
You must be signed in to change notification settings - Fork 17
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 as a fallback #467
RPC as a fallback #467
Conversation
| 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 => { |
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.
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") |
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.
HyperSync will fail as before
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.
Should I catch it and dispatchAction(ErrorExit(errHandler))
or simply throwing is fine?
let backoff = if retry === 0 { | ||
1 | ||
} else { | ||
retry * backoffMultiplicative |
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.
Lets make this exponential
// Hang until the process is terminated | ||
await Promise.make((_, _) => ()) |
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.
Lets throw here
~executeQuery=async query => { | ||
let response = await chainFetcher.sourceManager->executeQuery(~query, ~currentBlockHeight) | ||
dispatchAction(PartitionQueryResponse({chain, response, query})) |
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.
Lets keep the error exit explicit with try catch
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.
Great! 🥳
Part 1: #464
Part 2: #465
Part 3: