add start Instant to app

This commit is contained in:
Bryan Stitt 2023-09-18 12:33:58 -07:00
parent 7e60a21956
commit b5a1e9ff71

@ -53,7 +53,7 @@ use std::time::Duration;
use tokio::select; use tokio::select;
use tokio::sync::{broadcast, mpsc, oneshot, watch, Semaphore}; use tokio::sync::{broadcast, mpsc, oneshot, watch, Semaphore};
use tokio::task::{yield_now, JoinHandle}; use tokio::task::{yield_now, JoinHandle};
use tokio::time::sleep; use tokio::time::{sleep, Instant};
use tracing::{error, info, trace, warn, Level}; use tracing::{error, info, trace, warn, Level};
// TODO: make this customizable? // TODO: make this customizable?
@ -119,6 +119,8 @@ pub struct Web3ProxyApp {
pub vredis_pool: Option<RedisPool>, pub vredis_pool: Option<RedisPool>,
/// channel for sending stats in a background task /// channel for sending stats in a background task
pub stat_sender: Option<mpsc::UnboundedSender<AppStat>>, pub stat_sender: Option<mpsc::UnboundedSender<AppStat>>,
/// when the app started
pub start: Instant,
/// Optional time series database for making pretty graphs that load quickly /// Optional time series database for making pretty graphs that load quickly
influxdb_client: Option<influxdb2::Client>, influxdb_client: Option<influxdb2::Client>,
@ -491,9 +493,8 @@ impl Web3ProxyApp {
balanced_rpcs, balanced_rpcs,
bundler_4337_rpcs, bundler_4337_rpcs,
config: top_config.app.clone(), config: top_config.app.clone(),
pending_txid_firehose: deduped_txid_firehose,
frontend_port: frontend_port.clone(),
frontend_ip_rate_limiter, frontend_ip_rate_limiter,
frontend_port: frontend_port.clone(),
frontend_registered_user_rate_limiter, frontend_registered_user_rate_limiter,
hostname, hostname,
http_client, http_client,
@ -503,9 +504,11 @@ impl Web3ProxyApp {
jsonrpc_response_cache, jsonrpc_response_cache,
kafka_producer, kafka_producer,
login_rate_limiter, login_rate_limiter,
pending_txid_firehose: deduped_txid_firehose,
private_rpcs, private_rpcs,
prometheus_port: prometheus_port.clone(), prometheus_port: prometheus_port.clone(),
rpc_secret_key_cache, rpc_secret_key_cache,
start: Instant::now(),
stat_sender, stat_sender,
user_balance_cache, user_balance_cache,
user_semaphores, user_semaphores,