Skip to content

Commit

Permalink
fix: some logs and some debugging of getLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstevens19 committed Nov 12, 2024
1 parent 3b99ffe commit 4f98d00
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/src/indexer/fetch_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async fn live_indexing_stream(

// this is used for less busy chains to make sure they know rindexer is still alive
let mut last_no_new_block_log_time = Instant::now();
let log_no_new_block_interval = Duration::from_secs(20);
let log_no_new_block_interval = Duration::from_secs(300);

loop {
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
Expand All @@ -350,7 +350,7 @@ async fn live_indexing_stream(
);
if last_no_new_block_log_time.elapsed() >= log_no_new_block_interval {
info!(
"{} - {} - No new blocks published in the last 20 seconds - latest block number {}",
"{} - {} - No new blocks published in the last 5 minutes - latest block number {}",
info_log_name,
IndexingEventProgressStatus::Live.log(),
last_seen_block_number,
Expand Down
4 changes: 2 additions & 2 deletions core/src/indexer/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async fn live_indexing_for_contract_event_dependencies<'a>(
}

// this is used for less busy chains to make sure they know rindexer is still alive
let log_no_new_block_interval = Duration::from_secs(20);
let log_no_new_block_interval = Duration::from_secs(300);

loop {
tokio::time::sleep(Duration::from_millis(200)).await;
Expand Down Expand Up @@ -267,7 +267,7 @@ async fn live_indexing_for_contract_event_dependencies<'a>(
log_no_new_block_interval
{
info!(
"{} - {} - No new blocks published in the last 20 seconds - latest block number {}",
"{} - {} - No new blocks published in the last 5 minutes - latest block number {}",
&config.info_log_name,
IndexingEventProgressStatus::Live.log(),
latest_block_number
Expand Down
1 change: 1 addition & 0 deletions core/src/indexer/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ pub async fn start_indexing(

let start_block = last_known_start_block
.unwrap_or(network_contract.start_block.unwrap_or(latest_block));
info!("{} start_block is {}", event.info_log_name(), start_block);
let end_block =
std::cmp::min(network_contract.end_block.unwrap_or(latest_block), latest_block);
if let Some(end_block) = network_contract.end_block {
Expand Down
11 changes: 10 additions & 1 deletion core/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ impl JsonRpcCachedProvider {
&self,
filter: &RindexerEventFilter,
) -> Result<Vec<WrappedLog>, ProviderError> {
self.provider.request("eth_getLogs", [filter.raw_filter()]).await
// rindexer_info!("get_logs DEBUG [{:?}]", filter.raw_filter());
// LEAVING FOR NOW CONTEXT: TEMP FIX TO MAKE SURE FROM BLOCK IS ALWAYS SET
// let mut filter = filter.raw_filter().clone();
// if filter.get_from_block().is_none() {
// filter = filter.from_block(BlockNumber::Earliest);
// }
// rindexer_info!("get_logs DEBUG AFTER [{:?}]", filter);
let result = self.provider.request("eth_getLogs", [filter.raw_filter()]).await?;
// rindexer_info!("get_logs RESULT [{:?}]", result);
Ok(result)
}

pub async fn get_chain_id(&self) -> Result<U256, ProviderError> {
Expand Down

0 comments on commit 4f98d00

Please sign in to comment.