Skip to content

Commit

Permalink
perf(wasm): log rpc calls latency
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-melnychuk committed Oct 30, 2024
1 parent 620c5f0 commit 4fcec0f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ reqwest = { version = "0.12.3", default-features = false, features = ["json"] }

gloo-timers = { version = "0.3.0", features = ["futures"] }
web-sys = "0.3.69"
web-time = "1.1.0"


[dev-dependencies]
Expand Down
4 changes: 3 additions & 1 deletion src/eth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;
#[cfg(target_arch = "wasm32")]
use std::time::Instant;
use web_time::Instant;

use ethers::types::{Address, Bytes, SyncingStatus, H256};
use eyre::{Context, Result};
Expand Down Expand Up @@ -139,6 +139,7 @@ impl EthereumClient {
web_sys::console::log_1(
&format!("call to stateBlockNumber completed in {ms} ms").into(),
);
#[allow(unused_variables)]
let now = Instant::now();
}

Expand All @@ -152,6 +153,7 @@ impl EthereumClient {
web_sys::console::log_1(
&format!("call to stateBlockHash completed in {ms} ms").into(),
);
#[allow(unused_variables)]
let now = Instant::now();
}

Expand Down
11 changes: 11 additions & 0 deletions web/beerus-web/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4fcec0f

Please sign in to comment.