chore(sync): remove timeout from downloader (#356)

This commit is contained in:
Roman Krasiuk
2022-12-08 14:53:56 +02:00
committed by GitHub
parent 4fb3626546
commit ba758c5f54
3 changed files with 1 additions and 18 deletions

View File

@@ -7,7 +7,7 @@ use crate::{
use futures::Stream;
use reth_primitives::SealedHeader;
use reth_rpc_types::engine::ForkchoiceState;
use std::{pin::Pin, time::Duration};
use std::pin::Pin;
/// A Future for downloading a batch of headers.
pub type HeaderBatchDownload<'a> = Pin<
@@ -38,9 +38,6 @@ pub trait HeaderDownloader: Sync + Send + Unpin {
/// The Client used to download the headers
type Client: HeadersClient;
/// The request timeout duration
fn timeout(&self) -> Duration;
/// The consensus engine
fn consensus(&self) -> &Self::Consensus;

View File

@@ -24,7 +24,6 @@ use std::{
Arc,
},
task::{ready, Context, Poll},
time::Duration,
};
use tokio::sync::{watch, Mutex};
@@ -59,10 +58,6 @@ impl HeaderDownloader for TestHeaderDownloader {
type Consensus = TestConsensus;
type Client = TestHeadersClient;
fn timeout(&self) -> Duration {
Duration::from_millis(1000)
}
fn consensus(&self) -> &Self::Consensus {
&self.consensus
}

View File

@@ -35,8 +35,6 @@ pub struct LinearDownloader<C, H> {
client: Arc<H>,
/// The batch size per one request
pub batch_size: u64,
/// A single request timeout
pub request_timeout: Duration,
/// The number of retries for downloading
pub request_retries: usize,
}
@@ -49,11 +47,6 @@ where
type Consensus = C;
type Client = H;
/// The request timeout
fn timeout(&self) -> Duration {
self.request_timeout
}
fn consensus(&self) -> &Self::Consensus {
self.consensus.borrow()
}
@@ -77,7 +70,6 @@ impl<C: Consensus, H: HeadersClient> Clone for LinearDownloader<C, H> {
consensus: Arc::clone(&self.consensus),
client: Arc::clone(&self.client),
batch_size: self.batch_size,
request_timeout: self.request_timeout,
request_retries: self.request_retries,
}
}
@@ -422,7 +414,6 @@ impl LinearDownloadBuilder {
consensus,
client,
batch_size: self.batch_size,
request_timeout: self.request_timeout,
request_retries: self.request_retries,
}
}