Skip to content

Commit

Permalink
refactor(read-rpc): Add header referer: read-rpc to near-jsonrpc-clie…
Browse files Browse the repository at this point in the history
…nt (#99)

* refactor(read-rpc): Add header referer: read-rpc to near-jsonrpc-client

* Capitalize the first letter in referer word

Co-authored-by: ecp88 <109925246+ecp88@users.noreply.github.com>

---------

Co-authored-by: ecp88 <109925246+ecp88@users.noreply.github.com>
  • Loading branch information
khorolets and ecp88 authored Aug 10, 2023
1 parent d1707e6 commit 4243f6b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rpc-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ async fn main() -> anyhow::Result<()> {
init_logging(false)?;

let near_rpc_client = near_jsonrpc_client::JsonRpcClient::connect(opts.rpc_url.to_string());
// We want to set a custom referer to let NEAR JSON RPC nodes know that we are a read-rpc instance
let near_rpc_client = near_rpc_client.header(("Referer", "read-rpc"))?; // TODO: make it configurable
let blocks_cache = std::sync::Arc::new(std::sync::RwLock::new(lru::LruCache::new(
std::num::NonZeroUsize::new(100000).unwrap(),
)));
Expand Down

0 comments on commit 4243f6b

Please sign in to comment.