Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions availability-oracle/src/epoch_block_oracle_subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::pin::Pin;
use std::sync::Arc;

use std::time::Duration;
pub trait EpochBlockOracleSubgraph {
fn supported_networks(self: Arc<Self>) -> Pin<Box<dyn Stream<Item = Result<String, Error>>>>;
}
Expand All @@ -22,7 +22,10 @@ impl EpochBlockOracleSubgraphImpl {
Arc::new(EpochBlockOracleSubgraphImpl {
logger,
endpoint,
client: Client::new(),
client: Client::builder()
.timeout(Duration::from_secs(60))
.build()
.unwrap(),
})
}
}
Expand Down
5 changes: 3 additions & 2 deletions availability-oracle/src/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use bytes::Bytes;
use common::prelude::*;
use common::prometheus;
use moka::future::Cache;
use reqwest::Client;
use std::time::Duration;
use tiny_cid::Cid;

Expand All @@ -25,7 +26,7 @@ pub trait Ipfs {
pub struct IpfsImpl {
endpoint: String,
semaphore: tokio::sync::Semaphore,
client: reqwest::Client,
client: Client,

// Cache for CIDs; we invalidate this cache between runs to ensure we're checking
// IPFS regularly
Expand All @@ -38,7 +39,7 @@ pub struct IpfsImpl {
impl IpfsImpl {
pub fn new(endpoint: String, max_concurrent: usize, timeout: Duration) -> Self {
IpfsImpl {
client: reqwest::Client::new(),
client: Client::new(),
endpoint,
semaphore: tokio::sync::Semaphore::new(max_concurrent),
cache: Cache::new(10000),
Expand Down
8 changes: 6 additions & 2 deletions availability-oracle/src/network_subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use common::prelude::*;
use futures::stream;
use futures::Stream;
use multibase::Base;
use reqwest::Client;
use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::pin::Pin;
Expand Down Expand Up @@ -39,15 +40,18 @@ pub trait NetworkSubgraph {
pub struct NetworkSubgraphImpl {
logger: Logger,
endpoint: String,
client: reqwest::Client,
client: Client,
}

impl NetworkSubgraphImpl {
pub fn new(logger: Logger, endpoint: String) -> Arc<Self> {
Arc::new(NetworkSubgraphImpl {
logger,
endpoint,
client: reqwest::Client::new(),
client: Client::builder()
.timeout(Duration::from_secs(60))
.build()
.unwrap(),
})
}
}
Expand Down
Loading