Skip to content

Commit

Permalink
[ISSUES#]2721 health_check_provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
847850277 committed Nov 28, 2024
1 parent 7f4c228 commit d8a489d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/torii/core/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ impl<P: Provider + Send + Sync + std::fmt::Debug + 'static> Engine<P> {

pub async fn start(&mut self) -> Result<()> {
health_check_provider(self.provider.clone()).await;

let mut backoff_delay = Duration::from_secs(1);
let max_backoff_delay = Duration::from_secs(60);

Expand Down Expand Up @@ -302,6 +303,7 @@ impl<P: Provider + Send + Sync + std::fmt::Debug + 'static> Engine<P> {
// TODO: since we now process blocks in chunks we can parallelize the fetching of data
pub async fn fetch_data(&mut self, cursors: &Cursors) -> Result<FetchDataResult> {
let latest_block = self.provider.block_hash_and_number().await?;

let from = cursors.head.unwrap_or(0);
let total_remaining_blocks = latest_block.block_number - from;
let blocks_to_process = total_remaining_blocks.min(self.config.blocks_chunk_size);
Expand Down

0 comments on commit d8a489d

Please sign in to comment.