Skip to content

Commit

Permalink
Additional metadata logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tgmichel committed Feb 16, 2023
1 parent b9c475c commit 7fc6a56
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion client/db/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ where
BE: BackendT<Block> + 'static,
BE::State: StateBackend<BlakeTwo256>,
{
log::debug!(
target: "frontier-sql",
"🛠️ [Metadata] Retrieving digest data for {:?} block hashes",
hashes.len()
);
let mut out = Vec::new();
for &hash in hashes.iter() {
if let Ok(Some(header)) = client.header(hash) {
Expand All @@ -198,6 +203,10 @@ where
}
}
}
log::debug!(
target: "frontier-sql",
"🛠️ [Metadata] Retrieved digest data",
);
Ok(out)
}

Expand All @@ -221,7 +230,10 @@ where

let mut tx = self.pool().begin().await?;

// TODO move header retrieval to the blocking thread? depending on the batch size its likely to be necessary
log::debug!(
target: "frontier-sql",
"🛠️ [Metadata] Starting execution of statements on db transaction"
);
for metadata in block_metadata.into_iter() {
let post_hashes = metadata.post_hashes;
let ethereum_block_hash = post_hashes.block_hash.as_bytes().to_owned();
Expand Down Expand Up @@ -270,6 +282,10 @@ where
let query = builder.build();
query.execute(&mut tx).await?;

log::debug!(
target: "frontier-sql",
"🛠️ [Metadata] Ready to commit",
);
tx.commit().await
}

Expand Down

0 comments on commit 7fc6a56

Please sign in to comment.