From 1a480b3cf93cb772ae76735b785699abe499c672 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Fri, 4 Oct 2024 07:21:24 -0400 Subject: [PATCH] commented out rate limiter --- backend/public/src/main.rs | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/backend/public/src/main.rs b/backend/public/src/main.rs index c5edf72..d7b3315 100644 --- a/backend/public/src/main.rs +++ b/backend/public/src/main.rs @@ -56,23 +56,23 @@ async fn main() { .init(); // if std::env::var("RUST_ENV").unwrap_or_else(|_| "development".to_string()) != "development" { - println!("we're not in development, starting up the rate limiter"); - let governor_conf = Arc::new( - GovernorConfigBuilder::default() - .per_second(2) - .burst_size(5) - .finish() - .unwrap(), - ); - - let governor_limiter = governor_conf.limiter().clone(); - let interval = Duration::from_secs(60); - // a separate background task to clean up - std::thread::spawn(move || loop { - std::thread::sleep(interval); - tracing::info!("rate limiting storage size: {}", governor_limiter.len()); - governor_limiter.retain_recent(); - }); + //println!("we're not in development, starting up the rate limiter"); + //let governor_conf = Arc::new( + // GovernorConfigBuilder::default() + // .per_second(2) + // .burst_size(5) + // .finish() + // .unwrap(), + //); + // + //let governor_limiter = governor_conf.limiter().clone(); + //let interval = Duration::from_secs(60); + //// a separate background task to clean up + //std::thread::spawn(move || loop { + // std::thread::sleep(interval); + // tracing::info!("rate limiting storage size: {}", governor_limiter.len()); + // governor_limiter.retain_recent(); + //}); // } // grabbing the database url from our env variables @@ -105,10 +105,10 @@ async fn main() { TraceLayer::new_for_http() .make_span_with(trace::DefaultMakeSpan::new().level(tracing::Level::INFO)) .on_response(trace::DefaultOnResponse::new().level(tracing::Level::INFO)), - ) - .layer(GovernorLayer { - config: governor_conf, - }); + ); + //.layer(GovernorLayer { + // config: governor_conf, + //}); // run it with hyper let listener = TcpListener::bind("0.0.0.0:3000").await.unwrap();