Skip to content

Commit

Permalink
fix: build error
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Jul 5, 2023
1 parent 03442f6 commit b78c0cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion components/hord-cli/src/cli/mod.rs
Expand Up @@ -330,7 +330,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
info!(ctx.expect_logger(), "Starting service...",);

let mut service = Service::new(config, ctx);
return service.run(predicates, cmd.hord_disabled).await;
return service.run(predicates).await;
}
},
Command::Config(subcmd) => match subcmd {
Expand Down
48 changes: 22 additions & 26 deletions components/hord-cli/src/service/mod.rs
Expand Up @@ -13,10 +13,9 @@ use crate::service::runloops::start_bitcoin_scan_runloop;

use chainhook_sdk::chainhooks::types::{
BitcoinChainhookSpecification, ChainhookConfig, ChainhookFullSpecification,
ChainhookSpecification,
};

use chainhook_sdk::chainhooks::types::ChainhookSpecification;
use chainhook_sdk::chainhooks::types::{ChainhookConfig, ChainhookFullSpecification};
use chainhook_sdk::observer::{start_event_observer, ObserverEvent};
use chainhook_sdk::utils::Context;
use chainhook_types::{BitcoinBlockSignaling, BitcoinChainEvent};
Expand All @@ -39,7 +38,6 @@ impl Service {
pub async fn run(
&mut self,
predicates: Vec<ChainhookFullSpecification>,
hord_disabled: bool,
) -> Result<(), String> {
let mut chainhook_config = ChainhookConfig::new();

Expand Down Expand Up @@ -129,29 +127,27 @@ impl Service {
let mut moved_event_observer_config = event_observer_config.clone();
let moved_ctx = self.ctx.clone();

let _ = hiro_system_kit::thread_named("Initial predicate processing")
.spawn(move || {
if let Some(mut chainhook_config) =
moved_event_observer_config.chainhook_config.take()
{
let mut bitcoin_predicates_ref: Vec<&BitcoinChainhookSpecification> =
vec![];
for bitcoin_predicate in chainhook_config.bitcoin_chainhooks.iter_mut()
{
bitcoin_predicate.enabled = false;
bitcoin_predicates_ref.push(bitcoin_predicate);
}
while let Ok(block) = rx.recv() {
let future = process_block_with_predicates(
block,
&bitcoin_predicates_ref,
&moved_event_observer_config,
&moved_ctx,
);
let res = hiro_system_kit::nestable_block_on(future);
if let Err(_) = res {
error!(moved_ctx.expect_logger(), "Initial ingestion failing");
}
let _ = hiro_system_kit::thread_named("Initial predicate processing")
.spawn(move || {
if let Some(mut chainhook_config) =
moved_event_observer_config.chainhook_config.take()
{
let mut bitcoin_predicates_ref: Vec<&BitcoinChainhookSpecification> =
vec![];
for bitcoin_predicate in chainhook_config.bitcoin_chainhooks.iter_mut() {
bitcoin_predicate.enabled = false;
bitcoin_predicates_ref.push(bitcoin_predicate);
}
while let Ok(block) = rx.recv() {
let future = process_block_with_predicates(
block,
&bitcoin_predicates_ref,
&moved_event_observer_config,
&moved_ctx,
);
let res = hiro_system_kit::nestable_block_on(future);
if let Err(_) = res {
error!(moved_ctx.expect_logger(), "Initial ingestion failing");
}
}
}
Expand Down

0 comments on commit b78c0cc

Please sign in to comment.