From 25e5caaab86b470d2f79a26b6a1bf3a401f653f1 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 27 Jun 2023 10:50:15 -0700 Subject: [PATCH] simple sleep for now. will fix with better waits later --- web3_proxy/src/bin/web3_proxy_cli/search_kafka.rs | 1 + web3_proxy/src/stats/stat_buffer.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web3_proxy/src/bin/web3_proxy_cli/search_kafka.rs b/web3_proxy/src/bin/web3_proxy_cli/search_kafka.rs index 6f4f0628..caf5fe97 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/search_kafka.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/search_kafka.rs @@ -57,6 +57,7 @@ impl SearchKafkaSubCommand { .kafka_urls .context("top_config.app.kafka_urls is required")?; + // TODO: sea-streamer instead of rdkafka? let mut consumer = ClientConfig::new(); let security_protocol = &top_config.app.kafka_protocol; diff --git a/web3_proxy/src/stats/stat_buffer.rs b/web3_proxy/src/stats/stat_buffer.rs index 6e4c8c1e..4936a44d 100644 --- a/web3_proxy/src/stats/stat_buffer.rs +++ b/web3_proxy/src/stats/stat_buffer.rs @@ -10,7 +10,7 @@ use migration::sea_orm::prelude::Decimal; use migration::sea_orm::DatabaseConnection; use std::time::Duration; use tokio::sync::broadcast; -use tokio::time::interval; +use tokio::time::{interval, sleep}; use tracing::{error, info, trace}; #[derive(Debug, Default)] @@ -162,6 +162,9 @@ impl StatBuffer { } } + // TODO: don't just sleep. wait for things to actually finish + sleep(Duration::from_secs(10)).await; + let saved_relational = self.save_relational_stats().await; info!("saved {} pending relational stat(s)", saved_relational);