class AsyncAdapter

Ruby on Rails 6.0.6

Since v5.2.8.1

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Active Job Async adapter

The Async adapter runs jobs with an in-process thread pool.

This is the default queue adapter. It’s well-suited for dev/test since it doesn’t need an external infrastructure, but it’s a poor fit for production since it drops pending jobs on restart.

To use this adapter, set queue adapter to :async:

config.active_job.queue_adapter = :async

To configure the adapter’s thread pool, instantiate the adapter and pass your own config:

config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new \
  min_threads: 1,
  max_threads: 2 * Concurrent.processor_count,
  idletime: 600.seconds

The adapter uses a Concurrent Ruby thread pool to schedule and execute jobs. Since jobs share a single thread pool, long-running jobs will block short-lived jobs. Fine for dev/test; bad for production.

Inherits from

Object

Methods (defined here)

Methods (inherited)

From Object (17)
From ActiveRecord::TestFixtures (4)
From ActiveSupport::Concern (2)

Type at least 2 characters to search.

↑↓ navigate · open · esc close