Skip to content

@saflib/jobs-db


Variable: cancelByIdJob()

const cancelByIdJob: (dbKey, params) => Promise<ReturnsError<{ attempt: number; authority: JobAuthority; concurrency_key: null | string; created_at: Date; dedupe_key: null | string; enqueued_by_operation_id: string; finished_at: null | Date; heartbeat_at: null | Date; id: string; max_attempts: number; operation_id: string; original_request_id: string; parent_job_id: null | string; priority: number; request: JobRequest; result: null | JobResult; run_at: Date; started_at: null | Date; status: "pending" | "running" | "retrying" | "succeeded" | "dead" | "cancelled"; updated_at: Date; user_id: string; }, CancelByIdJobError>>>>

Cancel a pending/retrying job (terminal_reason: cancelled-by-admin). Running and terminal jobs return JobNotCancellableError.

Parameters

ParameterType
dbKeysymbol
paramsCancelByIdJobParams

Returns

Promise<ReturnsError<{ attempt: number; authority: JobAuthority; concurrency_key: null | string; created_at: Date; dedupe_key: null | string; enqueued_by_operation_id: string; finished_at: null | Date; heartbeat_at: null | Date; id: string; max_attempts: number; operation_id: string; original_request_id: string; parent_job_id: null | string; priority: number; request: JobRequest; result: null | JobResult; run_at: Date; started_at: null | Date; status: "pending" | "running" | "retrying" | "succeeded" | "dead" | "cancelled"; updated_at: Date; user_id: string; }, CancelByIdJobError>>