Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Use slices where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcaricio committed Mar 11, 2023
1 parent 89df4cf commit eed21d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Task {
pub(crate) async fn fetch_next_pending(
connection: &mut AsyncPgConnection,
queue_name: &str,
task_names: &Vec<String>,
task_names: &[String],
) -> Option<Task> {
backie_tasks::table
.filter(backie_tasks::task_name.eq_any(task_names))
Expand Down
6 changes: 3 additions & 3 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl TaskStore for PgTaskStore {
async fn pull_next_task(
&self,
queue_name: &str,
task_names: &Vec<String>,
task_names: &[String],
) -> Result<Option<Task>, AsyncQueueError> {
let mut connection = self
.pool
Expand Down Expand Up @@ -114,7 +114,7 @@ pub mod test_store {
async fn pull_next_task(
&self,
queue_name: &str,
task_names: &Vec<String>,
task_names: &[String],
) -> Result<Option<Task>, AsyncQueueError> {
let mut tasks = self.tasks.lock().await;
let mut next_task = None;
Expand Down Expand Up @@ -201,7 +201,7 @@ pub trait TaskStore: Clone + Send + Sync + 'static {
async fn pull_next_task(
&self,
queue_name: &str,
task_names: &Vec<String>,
task_names: &[String],
) -> Result<Option<Task>, AsyncQueueError>;
async fn create_task(&self, new_task: NewTask) -> Result<Task, AsyncQueueError>;
async fn set_task_state(&self, id: TaskId, state: TaskState) -> Result<(), AsyncQueueError>;
Expand Down
2 changes: 1 addition & 1 deletion src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();
loop {
// Check if has to stop before pulling next task
if let Some(ref shutdown) = self.shutdown {
Expand Down

0 comments on commit eed21d2

Please sign in to comment.