Skip to content

Commit

Permalink
improvement according github comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kobayurii committed Oct 7, 2024
1 parent 0801b14 commit 9f9e96a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configuration/example.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ near_rpc_url = "https://beta.rpc.mainnet.near.org"

### Lake framework configuration
[lake_config]
# Number of threads to use for fetching data from fatnear
# Number of threads to use for fetching data from fastnear
# Default: 2 * available threads
#num_threads = 8

Expand Down
5 changes: 5 additions & 0 deletions rpc-server/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ lazy_static! {
"Optimistic updating status. 0: working, 1: not working",
).unwrap();

pub(crate) static ref CURRENT_PROTOCOL_VERSION: IntGauge = try_create_int_gauge(
"current_protocol_version",
"Current protocol version",
).unwrap();

pub(crate) static ref LEGACY_DATABASE_TX_DETAILS: IntCounterVec = register_int_counter_vec(
"legacy_database_tx_details",
"Total number of calls to the legacy database for transaction details",
Expand Down
6 changes: 4 additions & 2 deletions rpc-server/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ pub async fn get_current_protocol_version(
near_rpc_client: &JsonRpcClient,
) -> anyhow::Result<near_primitives::version::ProtocolVersion> {
let params = near_jsonrpc_client::methods::status::RpcStatusRequest;
Ok(near_rpc_client.call(params, None).await?.protocol_version)
let protocol_version = near_rpc_client.call(params, None).await?.protocol_version;
crate::metrics::CURRENT_PROTOCOL_VERSION.set(protocol_version as i64);
Ok(protocol_version)
}

async fn handle_streamer_message(
Expand Down Expand Up @@ -205,7 +207,7 @@ pub async fn update_final_block_regularly(
)
.await
{
tracing::error!("Error to handle_streamer_message: {:?}", err);
tracing::error!("Error in fn handle_streamer_message(): {:?}", err);
};
// Sleep for 500ms before the next iteration
tokio::time::sleep(std::time::Duration::from_millis(500)).await;
Expand Down

0 comments on commit 9f9e96a

Please sign in to comment.