refactor: slightly more verbose processor bootup trace

buddies-main-deployment
James Prestwich 3 years ago
parent 7de6914863
commit 7492491313
No known key found for this signature in database
GPG Key ID: 7CC174C250AD83AD
  1. 15
      rust/agents/processor/src/processor.rs

@ -32,6 +32,8 @@ use optics_core::{
use crate::{prover::Prover, prover_sync::ProverSync, settings::ProcessorSettings as Settings}; use crate::{prover::Prover, prover_sync::ProverSync, settings::ProcessorSettings as Settings};
static LAST_INSPECTED: &str = "lastInspected";
/// The replica processor is responsible for polling messages and waiting until they validate /// The replica processor is responsible for polling messages and waiting until they validate
/// before proving/processing them. /// before proving/processing them.
#[derive(Debug)] #[derive(Debug)]
@ -77,7 +79,6 @@ impl Replica {
tokio::spawn( tokio::spawn(
async move { async move {
use optics_core::traits::Replica; use optics_core::traits::Replica;
info!("Starting processor for {}", self.replica.name());
let domain = self.replica.local_domain(); let domain = self.replica.local_domain();
@ -89,10 +90,18 @@ impl Replica {
// - If not, wait and poll again // - If not, wait and poll again
// 4. Check if the proof is valid under the replica // 4. Check if the proof is valid under the replica
// 5. Submit the proof to the replica // 5. Submit the proof to the replica
let mut next_to_inspect: u32 = match Self::db_get(&self.db, "lastInspected")? { let mut next_to_inspect: u32 = match Self::db_get(&self.db, LAST_INSPECTED)? {
Some(n) => n + 1, Some(n) => n + 1,
None => 0, None => 0,
}; };
info!(
"Starting processor for {} {} at leaf index {}",
domain,
self.replica.name(),
next_to_inspect
);
loop { loop {
use optics_core::traits::Replica; use optics_core::traits::Replica;
let seq_span = tracing::trace_span!( let seq_span = tracing::trace_span!(
@ -109,7 +118,7 @@ impl Replica {
.await .await
{ {
Ok(true) => { Ok(true) => {
Self::db_put(&self.db, "lastInspected", next_to_inspect)?; Self::db_put(&self.db, LAST_INSPECTED, next_to_inspect)?;
next_to_inspect += 1; next_to_inspect += 1;
} }
Ok(false) => { Ok(false) => {

Loading…
Cancel
Save