use std::time::Duration;
use graphile_worker_migrations::MigrateError;
use super::client::WorkerUtils;
use super::types::{CleanupTask, RescheduleJobOptions};
use super::{actions, maintenance};
use graphile_worker_job::DbJob;
use graphile_worker_queries::errors::GraphileWorkerError;
use graphile_worker_recovery::{
ActiveWorkerRow, SweepStaleWorkersOptions, SweepStaleWorkersResult, WorkerRecoveryConfig,
};
impl WorkerUtils {
pub async fn remove_job(&self, job_key: &str) -> Result<(), GraphileWorkerError> {
actions::remove_job(self, job_key).await
}
pub async fn complete_jobs(&self, ids: &[i64]) -> Result<Vec<DbJob>, GraphileWorkerError> {
actions::complete_jobs(self, ids).await
}
pub async fn permanently_fail_jobs(
&self,
ids: &[i64],
reason: &str,
) -> Result<Vec<DbJob>, GraphileWorkerError> {
actions::permanently_fail_jobs(self, ids, reason).await
}
pub async fn reschedule_jobs(
&self,
ids: &[i64],
options: RescheduleJobOptions,
) -> Result<Vec<DbJob>, GraphileWorkerError> {
actions::reschedule_jobs(self, ids, options).await
}
pub async fn list_active_workers(
&self,
sweep_threshold: Duration,
) -> Result<Vec<ActiveWorkerRow>, GraphileWorkerError> {
maintenance::list_active_workers(self, sweep_threshold).await
}
pub async fn sweep_stale_workers(
&self,
options: SweepStaleWorkersOptions,
) -> Result<SweepStaleWorkersResult, GraphileWorkerError> {
maintenance::sweep_stale_workers(self, options).await
}
pub async fn sweep_stale_workers_with_config(
&self,
recovery_config: &WorkerRecoveryConfig,
options: SweepStaleWorkersOptions,
) -> Result<SweepStaleWorkersResult, GraphileWorkerError> {
maintenance::sweep_stale_workers_with_config(self, recovery_config, options).await
}
pub async fn force_unlock_workers(
&self,
worker_ids: &[&str],
) -> Result<(), GraphileWorkerError> {
actions::force_unlock_workers(self, worker_ids).await
}
pub async fn cleanup(&self, tasks: &[CleanupTask]) -> Result<(), GraphileWorkerError> {
maintenance::cleanup(self, tasks).await
}
pub async fn migrate(&self) -> Result<(), MigrateError> {
maintenance::migrate(self).await
}
}