Skip to content

Commit

Permalink
add rabbitmq test
Browse files Browse the repository at this point in the history
  • Loading branch information
thorrester committed Sep 24, 2024
1 parent de42531 commit 0b3dda0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: always()
run: docker compose -f "docker-compose.yml" down

test-kafka:
test-kafka-rabbitmq:
needs: test-os
name: test kafka

Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ async fn start_main_server() -> Result<(), anyhow::Error> {
startup_kafka(pool.clone()).await?;
}

startup_rabbitmq(pool.clone()).await?;
if std::env::var("RABBITMQ_ADDR").is_ok() {
startup_rabbitmq(pool.clone()).await?;
}

// run drift background task
let num_scheduler_workers = std::env::var("NUM_SCOUTER_SCHEDULER_WORKERS")
Expand Down
2 changes: 1 addition & 1 deletion src/rabbitmq/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub async fn startup_rabbitmq(pool: Pool<Postgres>) -> Result<(), anyhow::Error>
info!("Starting RabbitMQ consumer");

let num_rabbits = std::env::var("NUM_SCOUTER_RABBITMQ_CONSUMERS")
.unwrap_or_else(|_| "1".to_string())
.unwrap_or_else(|_| "3".to_string())
.parse::<usize>()
.map_err(|e| lapin::Error::from(std::io::Error::new(std::io::ErrorKind::Other, e)))?;

Expand Down

0 comments on commit 0b3dda0

Please sign in to comment.