Skip to content

Commit fe59006

Browse files
committed
ipfs: Unify timeout config
1 parent d841e67 commit fe59006

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

core/src/subgraph/instance_manager.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use graph::{components::ethereum::NodeCapabilities, data::store::scalar::Bytes};
2828

2929
use super::loader::load_dynamic_data_sources;
3030
use super::SubgraphInstance;
31-
use crate::subgraph::registrar::IPFS_SUBGRAPH_LOADING_TIMEOUT;
3231

3332
lazy_static! {
3433
/// Size limit of the entity LFU cache, in bytes.
@@ -262,13 +261,7 @@ where
262261
let logger = logger_factory.component_logger("SubgraphInstanceManager", None);
263262
let logger_factory = logger_factory.with_parent(logger.clone());
264263

265-
let link_resolver = Arc::new(
266-
link_resolver
267-
.as_ref()
268-
.clone()
269-
.with_timeout(*IPFS_SUBGRAPH_LOADING_TIMEOUT)
270-
.with_retries(),
271-
);
264+
let link_resolver = Arc::new(link_resolver.as_ref().clone().with_retries());
272265

273266
SubgraphInstanceManager {
274267
logger_factory,

core/src/subgraph/registrar.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
use std::collections::HashSet;
2-
use std::env;
3-
use std::time::{Duration, Instant};
2+
use std::time::Instant;
43

54
use async_trait::async_trait;
6-
use graph::blockchain::BlockchainMap;
7-
use lazy_static::lazy_static;
8-
95
use graph::blockchain::Blockchain;
6+
use graph::blockchain::BlockchainMap;
107
use graph::components::store::{DeploymentId, DeploymentLocator, SubscriptionManager};
118
use graph::data::subgraph::schema::SubgraphDeploymentEntity;
129
use graph::prelude::{
1310
CreateSubgraphResult, SubgraphAssignmentProvider as SubgraphAssignmentProviderTrait,
1411
SubgraphRegistrar as SubgraphRegistrarTrait, *,
1512
};
1613

17-
lazy_static! {
18-
// The timeout for IPFS requests in seconds
19-
pub static ref IPFS_SUBGRAPH_LOADING_TIMEOUT: Duration = Duration::from_secs(
20-
env::var("GRAPH_IPFS_SUBGRAPH_LOADING_TIMEOUT")
21-
.unwrap_or("60".into())
22-
.parse::<u64>()
23-
.expect("invalid IPFS subgraph loading timeout")
24-
);
25-
}
26-
2714
pub struct SubgraphRegistrar<C, L, P, S, SM> {
2815
logger: Logger,
2916
logger_factory: LoggerFactory,
@@ -61,13 +48,7 @@ where
6148
SubgraphRegistrar {
6249
logger,
6350
logger_factory,
64-
resolver: Arc::new(
65-
resolver
66-
.as_ref()
67-
.clone()
68-
.with_timeout(*IPFS_SUBGRAPH_LOADING_TIMEOUT)
69-
.with_retries(),
70-
),
51+
resolver: Arc::new(resolver.as_ref().clone().with_retries()),
7152
provider,
7253
store,
7354
subscription_manager,

docs/environment-variables.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ those.
4848

4949
- `GRAPH_MAPPING_HANDLER_TIMEOUT`: amount of time a mapping handler is allowed to
5050
take (in seconds, default is unlimited)
51-
- `GRAPH_IPFS_SUBGRAPH_LOADING_TIMEOUT`: timeout for IPFS requests made to load
52-
subgraph files from IPFS (in seconds, default is 60).
53-
- `GRAPH_IPFS_TIMEOUT`: timeout for IPFS requests from mappings using `ipfs.cat`
54-
or `ipfs.map` (in seconds, default is 30).
51+
- `GRAPH_IPFS_TIMEOUT`: timeout for IPFS, which includes requests for manifest files
52+
and from mappings using `ipfs.cat` or `ipfs.map` (in seconds, default is 30).
5553
- `GRAPH_MAX_IPFS_FILE_BYTES`: maximum size for a file that can be retrieved
5654
with `ipfs.cat` (in bytes, default is unlimited)
5755
- `GRAPH_MAX_IPFS_MAP_FILE_SIZE`: maximum size of files that can be processed

0 commit comments

Comments
 (0)