Skip to content

Commit

Permalink
change function doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Feb 2, 2025
1 parent 378ca05 commit 1c5aae5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/bgworker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,19 +444,19 @@ impl Queue {
}
}

/// Change the status of jobs.
/// Requeued job with the given minutes ages.
///
/// # Errors
/// - If no queue provider is configured, it will return an error indicating the lack of configuration.
/// - If the Redis provider is selected, it will return an error stating that clearing jobs is not supported.
/// - Any error in the underlying provider's job clearing logic will propagate from the respective function.
pub async fn requeue(&self, from_age: &i64) -> Result<()> {
tracing::debug!(from_age = from_age, "requeue jobs");
pub async fn requeue(&self, age_minutes: &i64) -> Result<()> {
tracing::debug!(age_minutes = age_minutes, "requeue jobs");
match self {
#[cfg(feature = "bg_pg")]
Self::Postgres(pool, _, _) => pg::requeue(pool, from_age).await,
Self::Postgres(pool, _, _) => pg::requeue(pool, age_minutes).await,
#[cfg(feature = "bg_sqlt")]
Self::Sqlite(pool, _, _) => sqlt::requeue(pool, from_age).await,
Self::Sqlite(pool, _, _) => sqlt::requeue(pool, age_minutes).await,
#[cfg(feature = "bg_redis")]
Self::Redis(_, _, _) => {
tracing::error!("Update status for redis provider not implemented");
Expand Down
7 changes: 4 additions & 3 deletions src/bgworker/pg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,11 @@ pub async fn clear_jobs_older_than(
Ok(())
}

/// Change the status of jobs in the `pg_loco_queue` table.
/// Requeues jobs from [`JobStatus::Processing`] to [`JobStatus::Queued`].
///
/// This function changes the status of all jobs that currently have the `from` status
/// to the new `to` status.
/// This function updates the status of all jobs that are currently in the [`JobStatus::Processing`] state
/// to the [`JobStatus::Queued`] state, provided they have been updated more than the specified age (`age_minutes`).
/// The jobs that meet the criteria will have their `updated_at` timestamp set to the current time.
///
/// # Errors
///
Expand Down
7 changes: 4 additions & 3 deletions src/bgworker/sqlt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,11 @@ pub async fn clear_by_status(pool: &SqlitePool, status: Vec<JobStatus>) -> Resul
Ok(())
}

/// Change the status of jobs in the `sqlt_loco_queue` table.
/// Requeues jobs from [`JobStatus::Processing`] to [`JobStatus::Queued`].
///
/// This function changes the status of all jobs that currently have the `from` status
/// to the new `to` status.
/// This function updates the status of all jobs that are currently in the [`JobStatus::Processing`] state
/// to the [`JobStatus::Queued`] state, provided they have been updated more than the specified age (`age_minutes`).
/// The jobs that meet the criteria will have their `updated_at` timestamp set to the current time.
///
/// # Errors
///
Expand Down

0 comments on commit 1c5aae5

Please sign in to comment.