DataQueueDataQueue

JobRecord

The JobRecord interface represents a job stored in the queue, including its status, attempts, and metadata.

Fields

  • id: number — Unique job ID.
  • jobType: string — The type of the job.
  • payload: any — The job payload.
  • status: 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled' — Current job status.
  • createdAt: Date — When the job was created.
  • updated_at: Date — When the job was last updated.
  • locked_at: Date | null — When the job was locked for processing.
  • locked_by: string | null — Worker that locked the job.
  • attempts: number — Number of attempts so far.
  • maxAttempts: number — Maximum allowed attempts.
  • nextAttemptAt: Date | null — When the next attempt is scheduled.
  • priority: number — Job priority.
  • runAt: Date — When the job is scheduled to run.
  • pendingReason?: string | null — Reason for pending status.
  • errorHistory?: { message: string; timestamp: string }[] — Error history for the job.
  • timeoutMs?: number | null — Timeout for this job in milliseconds.
  • failureReason?: FailureReason | null — Reason for last failure, if any.
  • completedAt: Date | null — When the job was completed.
  • startedAt: Date | null — When the job was first picked up for processing.
  • lastRetriedAt: Date | null — When the job was last retried.
  • lastFailedAt: Date | null — When the job last failed.
  • lastCancelledAt: Date | null — When the job was last cancelled.

On this page