Skip to content

Commit

Permalink
Fix API queue
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakycrow committed Feb 22, 2025
1 parent 63f6270 commit 83b3afe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/api/app_state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use super::config::Config;
use crate::{db::connect_to_database, storage::s3::create_s3_client, workers};
use crate::{
db::connect_to_database,
storage::s3::create_s3_client,
workers::{self, events::PRIMARY_STREAM},
};
use sqlx::PgPool;

/// Shared state available to the API
Expand All @@ -22,7 +26,7 @@ impl AppState {

// Connect to the job queue
let nats_client = workers::create_nats_client().await?;
let jq_name = "FARMHAND_JOBS".to_string();
let jq_name = PRIMARY_STREAM.to_string();
let job_queue = workers::Queue::connect(jq_name, nats_client)
.await
.expect("Failed to create worker queue");
Expand Down
7 changes: 5 additions & 2 deletions src/bin/stream_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
//! It intentionally does not do anything else
use anyhow::Result;
use farmhand::workers::{self, events::EVENT_PREFIX};
use farmhand::workers::{
self,
events::{EVENT_PREFIX, PRIMARY_STREAM},
};
use futures::StreamExt;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};

Expand All @@ -21,7 +24,7 @@ async fn main() -> Result<()> {
// Setup the Jetstream queue
let jq_name = std::env::args()
.nth(1)
.unwrap_or_else(|| "FARMHAND_JOBS".to_string());
.unwrap_or_else(|| PRIMARY_STREAM.to_string());
let queue = workers::Queue::connect(jq_name, nats_client)
.await
.expect("Failed to create worker queue");
Expand Down

0 comments on commit 83b3afe

Please sign in to comment.