Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,7 @@ use uuid::Uuid;
use crate::{
queue::{Error as QueueError, InProgressTask, Queue},
scheduler::{Error as SchedulerError, Scheduler, ZonedSchedule},
task::{
Error as TaskError, Result as TaskResult, RetryPolicy, State as TaskState, Task, TaskId,
},
task::{Error as TaskError, Result as TaskResult, RetryPolicy, State as TaskState, Task},
worker::{Error as WorkerError, Worker},
};

Expand Down Expand Up @@ -907,25 +905,25 @@ impl<T: Task> EnqueuedJob<T> {
/// ```
pub async fn cancel(&self) -> Result<bool> {
let mut tx = self.queue.pool.begin().await?;
let in_progress_tasks = sqlx::query_as!(
InProgressTask,
let in_progress_tasks = sqlx::query_as::<_, InProgressTask>(
r#"
select
id as "id: TaskId",
task_queue_name as "queue_name",
id as id,
task_queue_name as queue_name,
input,
retry_policy as "retry_policy: RetryPolicy",
retry_policy as retry_policy,
timeout,
heartbeat,
concurrency_key
concurrency_key,
0::int as attempt_number
from underway.task
where input->>'job_id' = $1
and state = $2
for update skip locked
"#,
self.id.to_string(),
TaskState::Pending as TaskState
)
.bind(self.id.to_string())
.bind(TaskState::Pending as TaskState)
.fetch_all(&mut *tx)
.await?;

Expand Down
Loading