Skip to content

Commit

Permalink
Fix benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
MTRNord committed Oct 25, 2023
1 parent 008d7fd commit 6df5770
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/erooster_smtp/benches/smtp_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use futures::{SinkExt, StreamExt};
use secrecy::SecretString;
use sqlx::migrate::MigrateDatabase;
use std::str::FromStr;
use std::{path::Path, sync::Arc, thread, time::Duration};
use std::{path::Path, thread, time::Duration};
use tokio::net::TcpStream;
use tokio::runtime;
use tokio_util::codec::Framed;
Expand Down Expand Up @@ -98,11 +98,11 @@ pub fn criterion_benchmark(c: &mut Criterion) {
rt.spawn(async {
info!("Starting ERooster Server");
let config = if Path::new("./config.yml").exists() {
Arc::new(Config::load("./config.yml").await.unwrap())
Config::load("./config.yml").await.unwrap()
} else if Path::new("/etc/erooster/config.yml").exists() {
Arc::new(Config::load("/etc/erooster/config.yml").await.unwrap())
Config::load("/etc/erooster/config.yml").await.unwrap()
} else if Path::new("/etc/erooster/config.yaml").exists() {
Arc::new(Config::load("/etc/erooster/config.yaml").await.unwrap())
Config::load("/etc/erooster/config.yaml").await.unwrap()
} else {
error!("No config file found. Please follow the readme.");
return;
Expand All @@ -113,7 +113,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
sqlx::postgres::Postgres::create_database(&config.database.postgres_url)
.await
.unwrap();
match get_database(Arc::clone(&config)).await {
match get_database(&config).await {
Ok(database) => {
info!("Connected to database");
info!("Adding user");
Expand All @@ -125,7 +125,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
.unwrap();
info!("Created users");

let storage = get_storage(database.clone(), Arc::clone(&config));
let storage = get_storage(database.clone(), config.clone());

info!("Starting SMTP Server");
if let Err(e) = erooster_smtp::servers::unencrypted::Unencrypted::run(
Expand Down

0 comments on commit 6df5770

Please sign in to comment.