Mid-level Track Roadmap

Solid Queue: priorities

This course follows the priority number that every Solid Queue job row carries. It shows where the number comes from when no job sets one: Rails returns nil and Solid Queue stores 0. It covers static and block-based queue_with_priority, per-call overrides with .set(priority:), and the fixed precedence between them. It covers retries, which keep their priority unless retry_on sets one. It shows how one shared scope orders ready and blocked executions, and why priority never ages. It ends with named tiers for jobs sharing a queue.

What you'll learn

  • ✓How Rails's nil priority becomes Solid Queue's DEFAULT_PRIORITY of 0
  • ✓Static and block-based queue_with_priority, and how .set(priority:) overrides both
  • ✓How retries keep their priority and how retry_on's priority: option changes it
  • ✓How the shared ordered scope sorts ready and blocked executions by priority and job_id
  • ✓Why priority never ages and how a low-priority job can wait without limit
  • ✓How a small set of named priority tiers could organize jobs that share a queue
Free preview · Lesson 1 3 min read

Priority is a decision, not a default

No job in this app calls queue_with_priority; a search of app/jobs/ for priority finds nothing. Every job still has a priority, because every row in solid_queue_jobs does: db/queue_schema.rb makes the column null: false. This lesson is about where that number comes from when nobody asked for one.

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...