diff --git a/core/src/subgraph/registrar.rs b/core/src/subgraph/registrar.rs index b343487b280..a0196cd2c83 100644 --- a/core/src/subgraph/registrar.rs +++ b/core/src/subgraph/registrar.rs @@ -13,6 +13,9 @@ use graph::prelude::{ CreateSubgraphResult, SubgraphAssignmentProvider as SubgraphAssignmentProviderTrait, SubgraphRegistrar as SubgraphRegistrarTrait, *, }; +use graph::tokio_retry::Retry; +use graph::util::futures::retry_strategy; +use graph::util::futures::RETRY_DEFAULT_LIMIT; pub struct SubgraphRegistrar
{
logger: Logger,
@@ -518,15 +521,18 @@ async fn resolve_start_block(
.expect("cannot identify minimum start block because there are no data sources")
{
0 => Ok(None),
- min_start_block => chain
- .block_pointer_from_number(logger, min_start_block - 1)
- .await
- .map(Some)
- .map_err(move |_| {
- SubgraphRegistrarError::ManifestValidationError(vec![
- SubgraphManifestValidationError::BlockNotFound(min_start_block.to_string()),
- ])
- }),
+ min_start_block => Retry::spawn(retry_strategy(Some(2), RETRY_DEFAULT_LIMIT), move || {
+ chain
+ .block_pointer_from_number(&logger, min_start_block - 1)
+ .inspect_err(move |e| warn!(&logger, "Failed to get block number: {}", e))
+ })
+ .await
+ .map(Some)
+ .map_err(move |_| {
+ SubgraphRegistrarError::ManifestValidationError(vec![
+ SubgraphManifestValidationError::BlockNotFound(min_start_block.to_string()),
+ ])
+ }),
}
}
diff --git a/graph/src/data/subgraph/mod.rs b/graph/src/data/subgraph/mod.rs
index 886ad47aa0d..c4add562d5b 100644
--- a/graph/src/data/subgraph/mod.rs
+++ b/graph/src/data/subgraph/mod.rs
@@ -722,7 +722,7 @@ impl