Active Job Continuations are a Rails 8.1 feature that lets a long-running background job save its progress and resume from that point after a restart, instead of starting over. You split the job into named steps, track a cursor inside the slow step, and Rails re-enqueues the job with its progress when a deploy stops the worker.
This article shows how continuations work, how to write a resumable job, which queue backends support them, and the mistakes that make a resumable job unsafe. If you run jobs on Solid Queue, read it together with my guide to Solid Queue in Rails 8, and with the Kamal deploy guide if you ship with Kamal.
I ran the examples in this article against Rails 8.1.4.1, Solid Queue 1.7.2 and Ruby 3.3.6, with SQLite in development. I stopped a real
bin/jobsprocess withTERMin the middle of a job and watched it resume. I did not run Sidekiq or PostgreSQL for this article, so those points come from the source code and documentation.
The problem: long jobs and short shutdown windows
Every deploy restarts your job workers. A job that takes two seconds finishes before the worker stops. A job that loops over 200,000 records does not.
Before Rails 8.1 you had three bad options for that second job:
- Let the job be killed and run it again from the start. This wastes time, and it can send duplicate emails or charge a customer twice if the job is not safe to repeat.
- Write your own batching: enqueue one small job per batch, and store progress in a table.
- Raise the shutdown timeout so deploys wait for the job. This makes every deploy slower.
The Rails 8.1 release post describes continuations as especially useful for Kamal deploys, because Kamal gives job-running containers thirty seconds to shut down by default. The feature was led by Donal McBreen from 37signals.
How Active Job Continuations work
You include ActiveJob::Continuable in a job and put the work inside step blocks. The Active Job continuation source defines the rules:
- Steps run in the order they appear. Each step has a name, which must be a Symbol.
- Rails records each completed step. If the job is interrupted, completed steps are skipped when it resumes.
- A step can have a cursor, a value that marks progress inside the step. When the job resumes, the step gets the last saved cursor.
- Code outside a step runs on every execution, including resumed ones.
- A checkpoint is a point where the job may be interrupted. Rails asks the queue adapter
stopping?. If it returns true, the job raises an internalInterruptexception and is re-enqueued with its progress saved in the job data.
Checkpoints happen automatically before each step except the first one in an execution, and whenever you call set!, advance! or checkpoint! on a step. A job is never killed from the outside at a random line. It only stops where you allowed it to stop.
Write your first resumable job
Here is a job that sends a renewal reminder to every customer that has not had one. The reminded_at column tracks who is done.
# app/jobs/send_renewal_reminders_job.rb
class SendRenewalRemindersJob < ApplicationJob
include ActiveJob::Continuable
queue_as :default
self.max_resumptions = 20
def perform
step :send_reminders do |step|
Customer.where(reminded_at: nil).find_each(start: step.cursor) do |customer|
RenewalMailer.reminder(customer).deliver_now
customer.update!(reminded_at: Time.current)
step.advance! from: customer.id
end
end
step :notify_team do
TeamMailer.reminders_sent.deliver_now
end
end
endThree details matter here:
find_each(start: step.cursor)starts from the saved cursor. On the first run the cursor isnil, so it starts at the beginning.step.advance! from: customer.idsets the cursor tocustomer.id + 1(it callssuccon the value you pass) and creates a checkpoint. IDs do not need to be contiguous, becausefind_each(start:)begins at the next existing ID.- The job still filters on
reminded_at: nil. The cursor saves time, and the column is the real source of truth. I explain why in the pitfalls section.
What I saw when I stopped a worker
In my test app I replaced the mailer with a 0.2 second sleep and seeded 30 customers. I started bin/jobs, waited five seconds and sent TERM. The log showed the interruption:
Interrupted SendRenewalRemindersJob (Job ID: 0926cc43-...) at 'send_reminders', cursor '21' (stopping)Twenty customers had been processed. Solid Queue stored the job again as a scheduled job with this progress in its arguments:
{"completed" => [], "current" => ["send_reminders", 21]}I started bin/jobs again. After the default five-second wait, the job resumed at customer 21, processed the last ten and ran the final step. In total each customer was processed once.
Cursors: pick one that survives a restart
A cursor must be something Active Job can serialize as an argument: numbers, strings, symbols, arrays, hashes, and Active Record objects through GlobalID. It defaults to nil. The documentation shows these patterns:
| Use case | Cursor | Advance with |
|---|---|---|
| Records by ID | The last processed ID | step.advance! from: record.id |
| A plain array | An index, with start: 0 |
step.advance! |
| Nested loops | An array such as [account_id, record_id] |
step.set! [account.id, record.id + 1] |
| Allow a stop, no progress value | None | step.checkpoint! |
Prefer an ID cursor over an offset. If rows are added or deleted while the job is paused, find_each(start: id) still continues from the right place, while an offset can skip or repeat rows.
If you only need a stopping point and not a cursor (for example, when each loop iteration deletes the row it handled), call step.checkpoint! after each unit of work.
Which queue backends support continuations
A backend must tell Rails when it is shutting down, through queue_adapter.stopping?. As of November 8, 2026, from reading the source:
| Backend | Support |
|---|---|
| Solid Queue | Yes. Its adapter marks itself as stopping when a worker receives a stop signal. I ran this on 1.7.2. A community write-up says support arrived in 1.2.0 (July 2025), which I did not verify. |
| Sidekiq | The Sidekiq adapter sets stopping? when Sidekiq enters the quiet state. Check that your Sidekiq version includes the adapter code before relying on it. |
| Test adapter | Yes, and you can control it, which makes tests simple (see below). |
| Async adapter | It has no stopping? of its own, so it inherits the base adapter’s default, which only reports true if the adapter was marked as stopping. |
If an adapter never reports stopping, the job still works as a normal job. It just never pauses on a graceful shutdown, so you get no benefit.
Continuations only interrupt at a checkpoint. If a worker is killed without a graceful shutdown, for example
kill -9or an out-of-memory kill, no checkpoint runs and the job falls back to the backend’s normal recovery. Solid Queue’s README covers jobs interrupted by non-graceful process death.
Pitfalls that make resumable jobs unsafe
Steps can run again, so make them idempotent
Continuations reduce repeated work but do not remove it. If a worker crashes between sending an email and recording the cursor, the next run sends that email again. Write each unit of work so a repeat is harmless: filter on a “done” column like reminded_at, use find_or_create_by, or send an idempotency key to the payment provider.
Checkpoints are refused inside a transaction
A checkpoint inside an open database transaction raises ActiveJob::Continuation::CheckpointError with the message “Cannot checkpoint job with open transactions”. I reproduced this with Customer.transaction { step.checkpoint! }. Call advance! outside the transaction, after it commits.
Checkpoint more often than your shutdown timeout
Jobs are not interrupted when shutdown starts. They continue until the next checkpoint. Solid Queue’s default shutdown_timeout is 5 seconds, then it sends QUIT. If one loop iteration takes 20 seconds, the job will be cut off before it reaches a checkpoint. Keep the work between checkpoints well under your timeout. For a step that cannot checkpoint often, use isolated: true:
step :quick_step
step :slow_step, isolated: true
step :another_quick_stepAn isolated step always runs in its own execution, so progress up to that point is saved before the slow step begins.
Steps are matched by name and order
Rails validates the step list when a job resumes. Renaming a step, reordering steps or adding one in the middle while jobs are paused can raise ActiveJob::Continuation::InvalidStepError, for example “Step ‘x’ found, expected to resume from ‘y’”. Step names must be unique Symbols and cannot be nested. When you change a long job, either append new steps at the end, or let paused jobs drain before you deploy the change.
State between steps needs attributes
Instance variables do not survive an interruption. Code outside steps runs again, so reload records at the top of perform. To pass a result from one step to a later one, declare an attribute (ActiveJob::Continuable already includes ActiveJob::Attributes) and it is serialized with the job.
Errors after progress are resumed by default
If a continuable job raises an error after it completed a step or advanced a cursor, Rails resumes it instead of failing it. This is controlled by resume_errors_after_advancing, which defaults to true. I confirmed that a job that called step.set! 5 and then raised did not raise out of perform_now. It was re-enqueued instead.
This is convenient, but it can hide a permanent failure, because the job retries without a limit. Set max_resumptions (the default is unlimited). When the limit is reached, Rails raises ActiveJob::Continuation::ResumeLimitError. You can also use retry_on and discard_on for known errors, and set resume_errors_after_advancing = false if you want normal failure behavior.
The other options are resume_options (default { wait: 5.seconds }, passed to retry_job) and max_resumptions. Together:
# app/jobs/send_renewal_reminders_job.rb
self.max_resumptions = 20
self.resume_options = { wait: 1.second }
self.resume_errors_after_advancing = trueTest a continuable job
The test adapter can simulate a shutdown: its stopping? method accepts a boolean or a Proc that receives the job, as shown in the test adapter source. I read that source but did not write a test suite for this article, so check the exact helper API in your Rails version.
Whatever you use, test the failure you will meet in production: run the same step twice and assert that nothing is sent or charged twice.
When to use continuations, and when not to
Use them for long loops over records, imports, exports, backfills and bulk emails. Skip them for short jobs, which finish before any shutdown. For work that needs parallelism across many workers, enqueue many small jobs, or use a Solid Queue batch, because continuations run one job’s steps sequentially in one worker at a time.
A good rule: if a job would make you nervous to deploy during, make it continuable and idempotent. That removes the “do not deploy while the import runs” rule from your team.
Moving an existing app to Rails 8.1
Continuations need Rails 8.1. If you are on 7.2 or 8.0, follow the Rails 8.1 upgrade guide first. If your upgrade is stuck on old gems or a large job backlog, my legacy Rails modernization work covers moving apps to current Rails safely, including job infrastructure.
Conclusion
Active Job Continuations turn a long job from something you protect from deploys into something that survives them. The mechanism is small: named steps, an optional cursor, and checkpoints where the queue backend can stop the job. The risk is also small if you keep every step idempotent, avoid transactions at checkpoints, and set max_resumptions.
I help teams upgrade to current Rails, make background jobs safe to deploy, and clean up job infrastructure. If you have an import, billing run or backfill that blocks your deploys, send me a short brief and book a discovery call.
Frequently asked questions
What are Active Job Continuations?
They are a Rails 8.1 feature that splits a job into steps, saves progress when the job is interrupted, and resumes from the last completed step or cursor. You enable them by including ActiveJob::Continuable in a job.
Which Rails version do I need for Active Job Continuations?
Rails 8.1 or newer. The feature was announced with Rails 8.1 on October 22, 2025. Your queue backend must also report when it is stopping, as Solid Queue does.
Do continuations work with Sidekiq?
The Sidekiq adapter in the current Sidekiq source sets stopping? when Sidekiq quiets down, so jobs can be interrupted at checkpoints. Confirm this with the Sidekiq version you run, and test with a real shutdown.
Is a continuable job guaranteed to run each step only once?
No. Completed steps are skipped on resume, but a crash between a side effect and the saved progress can repeat work. Make each unit of work idempotent.
What happens if a continuable job keeps failing?
After progress, errors resume the job by default. Set max_resumptions to stop an endless loop, and Rails raises ActiveJob::Continuation::ResumeLimitError when the limit is reached. You can also set resume_errors_after_advancing to false.
Can I checkpoint inside a database transaction?
No. Rails raises ActiveJob::Continuation::CheckpointError (“Cannot checkpoint job with open transactions”). Commit the transaction first, then call advance!.
How is this different from retry_on?
retry_on runs the job again from the start after a specific error. Continuations resume from saved progress after an interruption, and, by default, after an error that happened once the job had made progress.


