Skip to content

Commit

Permalink
missing feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Dec 12, 2024
1 parent fa4aadc commit 87c01d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/bgworker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ impl Queue {
Self::Sqlite(pool, _, _) => {
sqlt::clear_jobs_older_than(pool, age_days, Some(status)).await
}
#[cfg(feature = "bg_redis")]
Self::Redis(_, _, _) => {
tracing::error!("clear jobs for redis provider not implemented");
Err(Error::string("clear jobs not supported for redis provider"))
Expand Down
5 changes: 5 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ enum Commands {
#[clap(value_parser = parse_key_val::<String,String>)]
params: Vec<(String, String)>,
},
#[cfg(any(feature = "bg_redis", feature = "bg_pg", feature = "bg_sqlt"))]
/// Managing jobs queue.
Jobs {
#[command(subcommand)]
Expand Down Expand Up @@ -424,6 +425,7 @@ impl From<DbCommands> for RunDbCommand {
}
}

#[cfg(any(feature = "bg_redis", feature = "bg_pg", feature = "bg_sqlt"))]
#[derive(Subcommand)]
enum JobsCommands {
/// Cancels jobs with the specified names, setting their status to
Expand Down Expand Up @@ -572,6 +574,7 @@ pub async fn main<H: Hooks, M: MigratorTrait>() -> crate::Result<()> {
run_db::<H, M>(&app_context, command.into()).await?;
}
}
#[cfg(any(feature = "bg_redis", feature = "bg_pg", feature = "bg_sqlt"))]
Commands::Jobs { command } => handle_job_command::<H>(command, &environment).await?,
Commands::Routes {} => {
let app_context = create_context::<H>(&environment).await?;
Expand Down Expand Up @@ -738,6 +741,7 @@ pub async fn main<H: Hooks>() -> crate::Result<()> {
let app_context = create_context::<H>(&environment).await?;
run_task::<H>(&app_context, name.as_ref(), &vars).await?;
}
#[cfg(any(feature = "bg_redis", feature = "bg_pg", feature = "bg_sqlt"))]
Commands::Jobs { command } => handle_job_command::<H>(command, &environment).await?,
Commands::Scheduler {
name,
Expand Down Expand Up @@ -796,6 +800,7 @@ fn create_root_span(environment: &Environment) -> tracing::Span {
tracing::span!(tracing::Level::DEBUG, "app", environment = %environment)
}

#[cfg(any(feature = "bg_redis", feature = "bg_pg", feature = "bg_sqlt"))]
async fn handle_job_command<H: Hooks>(
command: JobsCommands,
environment: &Environment,
Expand Down
1 change: 1 addition & 0 deletions src/tests_cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ pub mod app;
pub mod config;
#[cfg(feature = "with-db")]
pub mod db;
#[cfg(any(feature = "bg_pg", feature = "bg_sqlt"))]
pub mod queue;
pub mod task;
6 changes: 4 additions & 2 deletions src/tests_cfg/queue.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::path::PathBuf;

#[cfg(any(feature = "bg_pg", feature = "bg_sqlt"))]
use crate::bgworker;
use std::path::PathBuf;

#[cfg(feature = "bg_pg")]
/// # Panics
///
/// This function will panic if it fails to prepare or insert the seed data, causing the tests to fail quickly
Expand Down Expand Up @@ -36,6 +37,7 @@ pub async fn postgres_seed_data(pool: &sqlx::PgPool) {
}
}

#[cfg(feature = "bg_sqlt")]
/// # Panics
///
/// This function will panic if it fails to prepare or insert the seed data, causing the tests to fail quickly
Expand Down

0 comments on commit 87c01d0

Please sign in to comment.