diff --git a/indexer/queryapi_coordinator/src/main.rs b/indexer/queryapi_coordinator/src/main.rs index d663f7c8c..4789a2e50 100644 --- a/indexer/queryapi_coordinator/src/main.rs +++ b/indexer/queryapi_coordinator/src/main.rs @@ -1,4 +1,6 @@ +use std::time::SystemTime; use cached::SizedCache; +use chrono::{Timelike, Utc}; use futures::stream::{self, StreamExt}; use near_jsonrpc_client::JsonRpcClient; use tokio::sync::{Mutex, MutexGuard}; @@ -128,6 +130,13 @@ async fn handle_streamer_message( context: QueryApiContext<'_>, indexer_registry: SharedIndexerRegistry, ) -> anyhow::Result { + + let timestamp = context.streamer_message.block.header.timestamp_nanosec; + let now: u64 = Utc::now().timestamp_nanos() as u64; + let difference = now - timestamp; + let ms = difference / 1_000_000; + tracing::info!("Block lag is: {ms}ms"); + // build context for enriching filter matches cache::update_all(&context.streamer_message, context.redis_connection_manager).await?;