que-rb/que
57.5
Adequate · 19 September 2026
3k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a PostgreSQL-based background job processing library for Ruby, designed to manage asynchronous task execution through a command-line interface and programmatic APIs. It provides core capabilities for enqueuing jobs with priority and queue support, handling job buffering, and coordinating worker processes via database-level locking and notifications. The library integrates with major Ruby frameworks like Rails and Sequel, offering adapters for ActiveJob and robust database connection management to ensure data integrity during job execution and shutdown.
How it got here
2013–2014 — Que 2.x architectural rewrite
8 changes.
The project underwent a major architectural rewrite to establish Que 2.x, introducing a new modular structure with distinct classes for connections, pools, and job buffers. This period focused on overhauling the API, database schema, and configuration system to support modern Ruby versions and Active Job integration. Documentation and development environments were also updated to reflect these foundational changes.
2015–2017 — Rails and Ruby 3 integration
8 changes.
This period focused on modernizing Que's integration with the Ruby and Rails ecosystems, specifically adding support for Rails 7.1+ and Ruby 3 keyword arguments. The work involved refactoring internal utilities for better maintainability and implementing robust ActiveRecord and Sequel adapters to handle connection safety and advanced job querying.
2022 — Development automation and test expansion
9 changes.
This period focused on streamlining the local development workflow through new Docker and shell automation scripts, while significantly expanding test coverage across core components, ActiveJob, and ActiveRecord integrations. Concurrently, the codebase underwent maintenance to ensure Ruby 3 compatibility and introduced performance optimizations, such as conditional notification skipping in database triggers.
Features
Add CLI entry point for Que
A new executable script at bin/que has been added, serving as the entry point for the command-line interface. It loads the Que::CommandLineInterface module, enables unbuffered stdout for immediate output, and invokes the parser with command-line arguments to execute the tool.
bin · high confidence
Add Sequel model for que\_jobs table with advanced querying
Introduces a new Sequel model for the \que\_jobs\ table that supports querying jobs by class, queue, tag, and arguments. The model leverages the \pg\_json\_ops\ extension to handle JSONB fields, allowing searches against both the \args\ and \kwargs\ columns to support Ruby 3 job argument structures. It also defines subsets for job states such as ready, errored, expired, finished, and scheduled.
lib/que/sequel · high confidence
Initial release of the Que background job processor
This change introduces the Que gem (version 0.1.0), a PostgreSQL-based background job processing library for Ruby. It provides a command-line interface for starting workers, a connection pool wrapper for managing database connections, and core classes for job definition (Que::Job), job buffering with priority support (Que::JobBuffer), and a locker mechanism that uses PostgreSQL LISTEN/NOTIFY and polling to acquire and execute jobs. The initial implementation includes support for bulk enqueuing, configurable worker counts and priorities, and basic error handling.
lib/que · high confidence
New Docker entrypoint and test script for development setup
Added a new Docker entrypoint script that ensures the Bundler gem is installed and dependencies are present before launching the container, and a new test script that executes both standard RSpec specs and ActiveRecord specs (via the USE\_RAILS flag) to support a local development environment.
scripts · high confidence
New Rake tasks for testing shutdown behavior and specs
Added a \safe\_shutdown\ task to verify that Que correctly rolls back transactions when the process is killed by signals (SIGINT, SIGTERM, SIGKILL), ensuring data integrity during abrupt shutdowns. Also added a \spec\ task (aliased as \test\) to run the test suite using Rake::TestTask, replacing previous parallel test logic and standardizing the test execution path.
tasks · high confidence
New development environment automation scripts
Added a set of shell scripts in the \auto/\ directory to streamline the local development workflow. The \dev\ script builds and runs the development environment using \docker compose\, while \test\ executes the test suite within that environment. Additional scripts include \pre-push-hook\ for running checks before pushing code, \psql\ for opening a database shell, and \test-postgres-14\ for running tests against a specific PostgreSQL version.
auto · high confidence
Rails integration via Railtie
Que now automatically configures its logger to use the Rails logger and sets its connection to ActiveRecord (if available) through a new Railtie, enabling seamless integration with Rails applications without manual setup.
lib/que/rails · high confidence
Behavioural changes
Major architectural rewrite and API overhaul
The library has been completely rewritten, replacing the previous implementation with a new structure featuring distinct classes for connections, connection pools, listeners, and job buffers. This change introduces a new configuration API, including \Que.connection=\ for setting up database connections (supporting ActiveRecord, Sequel, Pond, and standard ConnectionPool) and \Que.use\_prepared\_statements=\ to control prepared statement usage. The default queue name is now 'default', and the public interface exposes methods like \enqueue\, \bulk\_enqueue\, \migrate!\, and \db\_version\ directly on the Que module. Additionally, the library now includes a migration system and integrates with Rails and ActiveJob when those frameworks are present.
lib · high confidence
New ActiveRecord integration layer with connection safety and job scoping
This change introduces a new ActiveRecord adapter module that manages database connection lifecycle and provides query helpers for job records. To prevent connection leaks in multi-database setups, the adapter now explicitly clears active connections after each job execution (with version-specific handling for ActiveRecord 7.1+), while skipping this step when \run\_synchronously\ is enabled. Additionally, the \Que::ActiveRecord::Model\ is defined with a fixed table name and includes scopes for filtering jobs by status (errored, expired, finished, scheduled, ready) and query methods for filtering by job class, queue, tag, and arguments.
_lib/que/active\record · high confidence
Que 2.x documentation and development environment overhaul
The project has shifted its primary documentation and development setup to support Que 2.x, explicitly stating that the master branch now refers to version 2.x while older versions are available on separate branches. The development environment is standardized on Ruby 3.2.2 (via .ruby-version and Dockerfile) and uses a modernized Docker Compose setup with PostgreSQL 13. The README has been completely rewritten to cover Que 2.x features, including the new CLI-based worker startup, bulk enqueueing, and Active Job integration, while the CHANGELOG has been consolidated to document the history up to version 2.4.1.
(repo-wide) · high confidence
Que migration 6: schema changes for Ruby 3 compatibility and performance
This migration updates the que\_jobs table to support Ruby 3 job arguments by splitting the args column into args and kwargs, adding a new kwargs JSONB column with a GIN index for faster querying. It also enforces a NOT NULL constraint on job\_schema\_version and renames the que\_poll\_idx index for consistency.
lib/que/migrations/6 · high confidence
Queues now support conditional notification skipping via session settings
The que\_job\_notify and que\_state\_notify triggers on the que\_jobs table have been updated to respect a new session-level setting, que.skip\_notify. When this setting is enabled (or set to 'true'), the triggers will suppress notifications for job insertions, updates, and deletions. This allows applications to disable notification overhead during bulk operations or other scenarios where immediate notification is not required, improving performance for high-volume job processing.
lib/que/migrations/7 · high confidence
Queues v4 migration: schema overhaul and new locker tracking
The database schema for job processing has been significantly restructured to support new features and improve performance. The primary key for jobs is now a simple integer ID rather than a composite key, and job arguments are migrated from a JSON array to a dedicated JSONB column, with a new JSONB data column introduced for extensible metadata like tags. Error handling is refined by splitting the last error into separate message and backtrace columns with length constraints, and the previous is\_processed flag is replaced by finished\_at and expired\_at timestamps to track job lifecycle states. A new que\_lockers table is added to track worker processes, including their PIDs, hostnames, and listening status, enabling more efficient job distribution via LISTEN/NOTIFY. Additionally, a que\_values table is created for flexible key-value storage, and various indexes and constraints are added to optimize polling and enforce data integrity.
lib/que/migrations/4 · high confidence
Refactored internal utilities into modular components
The internal implementation of lib/que/utils has been reorganized from a single module into distinct, focused modules (Assertions, Constantization, ErrorNotification, Freeze, Introspection, JSONSerialization, Logging, Middleware, QueueManagement, Ruby2Keywords, and Transactions). This change improves code maintainability and clarity by separating concerns such as error handling, logging, and job argument parsing (including Ruby 2/3 keyword compatibility) into their own files, without altering the external API or user-facing behavior.
lib/que/utils · high confidence
Support for Rails 7.1+ ActiveJob adapter and Ruby 3 keyword arguments
This change introduces a new ActiveJob adapter for Rails 7.1+ (where the built-in adapter was removed) and updates the job execution logic to support Ruby 3's keyword argument splitting. The adapter ensures compatibility by handling job serialization and ID mapping, while the extensions module splits job arguments into positional and keyword components to maintain correct behavior with modern Ruby versions. It also includes backward-compatibility fixes for job options and internal job ID access.
_lib/que/active\job · high confidence
Updated que\_jobs table schema and migration history
The database schema for the que\_jobs table has been updated to support job prioritization and queueing. Migration 1 introduces the initial table structure with a primary key based on priority, run\_at, and job\_id. Migration 2 changes the default priority from 1 to 100 to allow for more flexible job ordering. Migration 3 refines the schema by changing the priority column type to smallint, adding a non-null 'queue' column, and updating the primary key to include the queue field, enabling jobs to be organized into specific queues.
lib/que/migrations/1, lib/que/migrations/2, lib/que/migrations/3 · high confidence
Test coverage
Added CI gemfiles for Rails 6.0 through 7.2; Added placeholder for temporary spec files; Added test coverage for Que::Sequel::Model and Que::Utils modules; Added test support utilities for job logging and execution scenarios; Added tests for ActiveJob integration and extensions; Added tests for ActiveRecord integration and model queries; Expanded test coverage for Que core components; Initial test suite for core Que configuration and connection handling.
Dependencies
Update development dependencies and refine gem packaging
The project's Gemfile has been restructured to explicitly declare development and test dependencies, pinning Active Record and Active Job to version 7.2.0, adding Minitest 5.25.0 with several plugins (profile, hooks, fail-fast), and including Pry and pg\_examiner. The gemspec has been updated to require Ruby 2.7.0 or higher, set the homepage to the GitHub repository, and exclude unnecessary files (such as Gemfile, spec, and tasks directories) from the built gem package.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 57.
Lenses
- Code Health 98
- Architecture 99
- Maturity 48
- Readiness 39
- Security 93
- Domain Modelling 100
Changes since last survey
- 300 commits — 270 feature/other, 30 fixes
By area
- lib/que — 96 commits
- (root) — 86 commits
- (repo) — 66 commits
- docs/README.md — 15 commits
- .github/workflows — 10 commits
- spec/que — 8 commits
- bin/command_line_interface.rb — 5 commits
- spec/gemfiles — 5 commits
- lib/que.rb — 3 commits
- scripts/docker-entrypoint — 2 commits
- bin/command_line_interface.spec.rb — 1 commit
- bin/que — 1 commit
- scripts/test — 1 commit
- spec/spec_helper.rb — 1 commit
Notable commits
- fix: Bulk enqueue: Fix executing jobs in synchronous mode with the correct args, and do so only at the end of the .bulk_enqueue block
- fix: Fix CI failure from Docker Postgres image
- fix: Fix DB migration name of v7 in the CHANGELOG.md
- fix: Fix ToC links in docs
- fix: Fix activerecord 7.1 and 7.2 deprecations
- fix: Fix broken test for Test: Ruby 3.0, Rails 6.0 + 6.1, PostgreSQL 14 (#444)
- fix: Fix bundler in CI
- fix: Fix failing bulk_enqueue test when a particular test suite ordering is used
- fix: Fix internal document links
- fix: Fix job buffer push and shift deadlock test by preventing dropping of excess jobs above the buffer's max size
- fix: Fix link in main README
- fix: Fix links to Writing Reliable Jobs
- fix: Fix lock leak on PostgreSQL 12 and later
- fix: Fix specificity of Rails versions in spec gemfiles
- fix: Fix startup error: undefined method 'job_schema_version' for Que:Module
- fix: Fix tos
- fix: Merge pull request #275 from jonathanhefner/ci-fix-docker-postgres
- fix: Merge pull request #318 from greensync/fix-push-race-condition
- fix: Merge pull request #321 from que-rb/fix-worker-thread-attrition
- fix: Merge pull request #343 from que-rb/fix-startup-error-undefined-method-job_schema_version
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
que-rb/que was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 57cfa4a4d4ad3f23a4f20972ff2c7f4ceed58d85 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.