Skip to content

Commit ce61205

Browse files
author
Ludo Galabru
committed
fix: cache size
1 parent 2705b95 commit ce61205

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

components/chainhook-cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "chainhook"
3-
version = "0.13.0"
3+
version = "0.14.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

components/chainhook-cli/src/cli/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
644644
};
645645

646646
let transaction_identifier = TransactionIdentifier { hash: txid.clone() };
647-
let traversals_cache = new_traversals_lazy_cache();
647+
let traversals_cache = new_traversals_lazy_cache(1024);
648648
let traversal = retrieve_satoshi_point_using_lazy_storage(
649649
&hord_db_conn,
650650
&block_identifier,
@@ -666,7 +666,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
666666
let block =
667667
fetch_and_standardize_block(cmd.block_height, &bitcoin_config, &ctx)
668668
.await?;
669-
let traversals_cache = Arc::new(new_traversals_lazy_cache());
669+
let traversals_cache = Arc::new(new_traversals_lazy_cache(1024));
670670

671671
let _traversals = retrieve_inscribed_satoshi_points_from_block(
672672
&block,

components/chainhook-event-observer/src/observer/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,11 @@ pub async fn start_observer_commands_handler(
599599
let mut chainhooks_lookup: HashMap<String, ApiKey> = HashMap::new();
600600
let networks = (&config.bitcoin_network, &config.stacks_network);
601601
let mut bitcoin_block_store: HashMap<BlockIdentifier, BitcoinBlockData> = HashMap::new();
602-
let traversals_cache = Arc::new(new_traversals_lazy_cache());
602+
let cache_size = config
603+
.hord_config
604+
.and_then(|ref c| Some(c.cache_size))
605+
.unwrap_or(0);
606+
let traversals_cache = Arc::new(new_traversals_lazy_cache(cache_size));
603607

604608
loop {
605609
let command = match observer_commands_rx.recv() {

0 commit comments

Comments
 (0)