Skip to content

Commit

Permalink
Start backend concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
PolpOnline committed Jan 14, 2025
1 parent d36b047 commit aaeb58b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/backend/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ pub struct App {

impl App {
pub async fn new() -> color_eyre::Result<Self> {
let db = Self::setup_db().await?;
let redis_lib = Self::setup_redis_lib().await?;
let redis_fred = Self::setup_redis_fred().await?;
let smtp_client = init_smtp_client()?;
let (db, redis_lib, redis_fred, smtp_client) = tokio::try_join!(
Self::setup_db(),
Self::setup_redis_lib(),
Self::setup_redis_fred(),
init_smtp_client()
)?;

Ok(Self {
db,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/src/workers/email_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async fn query_down_services(db: &PgPool) -> GenericResult<Vec<EmailData>> {
Ok(rows)
}

pub fn init_smtp_client() -> Result<SmtpClient> {
pub async fn init_smtp_client() -> Result<SmtpClient> {
let host = std::env::var("EMAIL_HOST")?;
let username = std::env::var("EMAIL_USERNAME")?;
let password = std::env::var("EMAIL_PASSWORD")?;
Expand Down

0 comments on commit aaeb58b

Please sign in to comment.