diff --git a/src/lib.rs b/src/lib.rs index cbdf900..2d755a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,12 +23,12 @@ impl Default for RetentionMode { } } +pub use queue::Queue; pub use runnable::BackgroundTask; pub use store::{PgTaskStore, TaskStore}; pub use task::{CurrentTask, Task, TaskId, TaskState}; -pub use worker_pool::WorkerPool; pub use worker::Worker; -pub use queue::Queue; +pub use worker_pool::WorkerPool; pub mod errors; mod queries; diff --git a/src/queries.rs b/src/queries.rs index dda0885..a58ca60 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -65,7 +65,7 @@ impl Task { pub(crate) async fn fetch_next_pending( connection: &mut AsyncPgConnection, queue_name: &str, - task_names: &Vec, + task_names: &[String], ) -> Option { backie_tasks::table .filter(backie_tasks::task_name.eq_any(task_names)) diff --git a/src/store.rs b/src/store.rs index 83bd9f1..390d375 100644 --- a/src/store.rs +++ b/src/store.rs @@ -22,7 +22,7 @@ impl TaskStore for PgTaskStore { async fn pull_next_task( &self, queue_name: &str, - task_names: &Vec, + task_names: &[String], ) -> Result, AsyncQueueError> { let mut connection = self .pool @@ -114,7 +114,7 @@ pub mod test_store { async fn pull_next_task( &self, queue_name: &str, - task_names: &Vec, + task_names: &[String], ) -> Result, AsyncQueueError> { let mut tasks = self.tasks.lock().await; let mut next_task = None; @@ -201,7 +201,7 @@ pub trait TaskStore: Clone + Send + Sync + 'static { async fn pull_next_task( &self, queue_name: &str, - task_names: &Vec, + task_names: &[String], ) -> Result, AsyncQueueError>; async fn create_task(&self, new_task: NewTask) -> Result; async fn set_task_state(&self, id: TaskId, state: TaskState) -> Result<(), AsyncQueueError>; diff --git a/src/worker.rs b/src/worker.rs index a523657..05fb882 100644 --- a/src/worker.rs +++ b/src/worker.rs @@ -91,7 +91,7 @@ where } pub(crate) async fn run_tasks(&mut self) -> Result<(), BackieError> { - let registered_task_names = self.task_registry.keys().cloned().collect(); + let registered_task_names = self.task_registry.keys().cloned().collect::>(); loop { // Check if has to stop before pulling next task if let Some(ref shutdown) = self.shutdown {