Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rails/solid_queue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.6.0
Choose a base ref
...
head repository: rails/solid_queue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.7.0
Choose a head ref
  • 18 commits
  • 48 files changed
  • 6 contributors

Commits on Aug 18, 2026

  1. Clarify concurrency + bulk enqueuing is a perf caveat, not unsafe

    "is not a good idea" reads as a correctness warning; limits are in fact
    always respected, so the only downside is losing the bulk speedup.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    2 people authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    87f3fd1 View commit details
    Browse the repository at this point in the history
  2. Fix grammar in the bulk enqueuing note

    Co-Authored-By: Claude Fable 5 <[email protected]>
    rosa and claude committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    ef29b5d View commit details
    Browse the repository at this point in the history
  3. Wait for polling queries in logging tests instead of sleeping

    The "polling queries are logged" tests started a worker/dispatcher and
    slept for a fixed window before asserting the polling SELECT showed up
    in the log. On a slow CI runner, process boot (registration, pool
    startup) can eat the whole window before the first poll runs, failing
    the test.
    
    Poll the captured log for the expected query with a timeout instead:
    as fast as before in the common case, and robust when the runner is
    slow.
    
    Related to #602
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    5b4360f View commit details
    Browse the repository at this point in the history
  4. Give the dispatcher time to boot in the zero-sleep polling test

    "sleeps 0.seconds between polls" started the dispatcher and waited only
    1 second (without raising) for all three scheduled jobs to be
    dispatched. On a slow CI runner the dispatcher thread may not have
    booted and polled within that window, so the test failed on the
    scheduled executions count with all three jobs still there.
    
    Wait up to 5 seconds instead; the wait returns as soon as the jobs are
    dispatched, so the test's runtime is unchanged in the common case.
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    554bd45 View commit details
    Browse the repository at this point in the history
  5. Keep semaphore slots held while blocked jobs are enqueued in concurre…

    …ncy test
    
    "run several jobs over the same record limiting concurrency" claims all
    three semaphore slots with jobs A, B and C, then enqueues D-H expecting
    all five to block. A and B only paused for 0.5 seconds, so on a slow CI
    runner they could finish while D-H were still being inserted, freeing a
    slot that let some of them run instead of blocking and failing the +5
    BlockedExecution assertion.
    
    Give A and B enough pause to outlive the enqueue window, and bump C
    accordingly so it still saves last.
    
    Related to #602
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    a0fc4de View commit details
    Browse the repository at this point in the history
  6. Give in-flight jobs enough pause to survive slow shutdowns in tests

    Three tests assert that a job paused mid-flight does NOT complete while
    its process is terminated: the async and forked "term supervisor
    exceeding timeout" tests and "don't block claimed executions that get
    released". They paused the job for shutdown_timeout + 10 seconds, but
    that clock starts when the job starts executing, and on a slow CI
    runner the test's detection waits (up to 8 seconds of polling for the
    job to show as started) plus the termination window (up to 7 more) can
    outlast it: the sleep finishes inside the still-alive process, the job
    writes its completed status, and the assertion fails.
    
    Widen the pause to shutdown_timeout + 30 seconds. The job is killed
    mid-sleep either way, so the test's runtime doesn't change; only the
    margin against slow runners does.
    
    Related to #602
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    091a721 View commit details
    Browse the repository at this point in the history
  7. Add forensics to the pause-job assertion in the async lifecycle test

    The pause job's sleep is far longer than the test's entire timeline, so
    when this assertion fails on CI with the job completed, the write must
    have come from outside the test's own flow — a process or thread leaked
    from a neighboring test. That can't be diagnosed from "expected
    completed to not be equal to completed", so include all job results and
    the registered processes in the failure message.
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    f1930e3 View commit details
    Browse the repository at this point in the history
  8. Wait reliably for the killed job to start in "kill worker individually"

    The test waits for the job's "started" result before SIGKILLing the
    worker, but with the non-raising wait and only 2 seconds of margin: on a
    slow runner, worker boot plus polling plus claiming can take longer, the
    guard gives up silently, and the KILL lands before the job ever starts —
    so the "started" row the test asserts on later never gets written.
    
    Use the raising variant with a 10 second margin, so a job that never
    starts fails the test right at the guard, and widen the job's pause so
    the KILL can't arrive after the pause has already finished on a slow
    runner (which would complete the job and erase the "started" status
    too). Neither change affects the test's runtime in the intended flow.
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    50bddee View commit details
    Browse the repository at this point in the history
  9. Wait longer for the supervisor to fail the killed worker's job

    "supervisor handles missing process record" gave the supervisor only 3
    seconds (without raising) to notice the KILLed worker and fail its
    claimed execution. The supervisor checks for terminated forks about once
    a second, so on a slow runner reaping plus the failure write can exceed
    that window and the test fails on the missing FailedExecution, two
    occurrences on CI recently.
    
    Give it 10 seconds, and the initial boot wait 3, both returning as soon
    as the condition is met.
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    fc5fb59 View commit details
    Browse the repository at this point in the history
  10. Include the error in fail_many_claimed events and document recovery

    Jobs running on a process that dies without a clean shutdown are marked
    as failed with ProcessPrunedError (or ProcessExitError when the
    supervisor reaps a crashed fork) via ClaimedExecution.fail_all_with,
    which already emits a fail_many_claimed event with the affected job and
    process ids. The error itself wasn't part of the payload though, so
    subscribers couldn't tell these mass failures apart from each other.
    
    Add the error to the event payload and to the log line, and document how
    to subscribe to the event to implement a custom recovery policy for
    these jobs, including why Solid Queue doesn't retry them automatically.
    
    Closes #591
    wintan1418 authored and rosa committed Aug 18, 2026
    Configuration menu
    Copy the full SHA
    6816e52 View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2026

  1. Replace terminated forks even if releasing their claimed jobs fails

    When the database restarts under a running fork supervisor, the workers
    and dispatcher crash and exit. The supervisor reaps them and calls
    replace_fork, which released the terminated fork's claimed jobs — a
    database call — before starting the replacement. With the database still
    down that call raised, the exception crashed the supervise loop, and the
    terminated forks were never replaced: the scheduler (which survives
    enqueue errors) kept enqueueing recurring jobs that nothing would ever
    process, until the whole thing was restarted by hand.
    
    Rescue errors from the release, report them through handle_thread_error
    and start the replacement regardless. The database being unreachable at
    that point is likely the very reason the fork died, so replacing it
    can't depend on the database being back. The terminated fork's claimed
    jobs aren't lost: its stale registration gets pruned once the database
    is reachable again, which fails them through the regular path so they
    can be retried.
    
    Fixes #683
    wintan1418 authored and rosa committed Aug 20, 2026
    Configuration menu
    Copy the full SHA
    0526401 View commit details
    Browse the repository at this point in the history
  2. Protect the shutdown reap from release failures too

    Extract the rescued release into attempt_to_release_claimed_jobs_by and
    use it from reap_terminated_forks as well: a database that is down when
    the supervisor shuts down should not abort the reap loop or skip exit
    hooks, for the same reason it should not stop a replacement.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    rosa and claude committed Aug 20, 2026
    Configuration menu
    Copy the full SHA
    174cb07 View commit details
    Browse the repository at this point in the history
  3. Honour TERM received during supervisor boot before forking workers

    Signals queued while start hooks run were only drained in the supervise
    loop, after children had already been forked. Those children still held
    the inherited enqueue-only trap, so a forwarded TERM was dropped and
    workers kept claiming jobs until SIGKILL. Drain the queue before each
    fork, skip supervise when already stopped, and re-arm child handlers
    immediately after fork.
    Pissardo authored and rosa committed Aug 20, 2026
    Configuration menu
    Copy the full SHA
    124176a View commit details
    Browse the repository at this point in the history
  4. Name the supervisor's stop checkpoint and simplify its lifecycle

    Extract the repeated drain-signals-then-decide idiom into time_to_stop?
    and use it from both loops that poll it, turn start's early exit into a
    single shutdown-or-supervise branch, and move the child's signal handler
    re-arming into create_fork, dropping the duplicate registration in boot:
    forked processes only ever boot through create_fork, so the traps are
    always already armed by then.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    rosa and claude committed Aug 20, 2026
    Configuration menu
    Copy the full SHA
    fcb5f7a View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2026

  1. Add batch support

    Batches group jobs so the progress of the whole set can be tracked and
    callbacks fired based on its status: on_finish once every job has
    finished, even when some failed; on_success only when all of them
    succeeded; and on_failure when at least one failed for good. Callbacks
    can be given as job classes or configured job instances, they're
    serialized when the batch is created, and they always enqueue through
    Solid Queue in the batch's finishing transaction, regardless of the job
    classes' adapters.
    
    A job joins the batch that's active when its enqueue is requested,
    which also covers enqueues Rails defers until after the surrounding
    transaction commits, and jobs can enqueue more jobs into their own
    batch while it runs. Membership lives on the job's batch_id, while a
    solid_queue_batch_executions row tracks each outstanding attempt: the
    batch finishes, through a single-winner update, when no tracking rows
    remain, without ever locking the batch row outside that one moment.
    Batches that can't detect their own completion — bulk-discarded jobs,
    processes that crashed between enqueueing and starting a batch, or
    completions rolled back by failing callback enqueues — are swept by the
    dispatcher as part of its regular maintenance.
    
    Batches track total, completed, failed and pending job counts, take a
    description and arbitrary metadata, and finished ones are cleared with
    clear_finished_in_batches, keeping failed batches around for
    inspection.
    jpcamara authored and rosa committed Aug 21, 2026
    Configuration menu
    Copy the full SHA
    1bcac83 View commit details
    Browse the repository at this point in the history
  2. Refine batch support after a full review

    * Count logical jobs in batch counters instead of attempts: retries
      keep their active_job_id, so a job that fails twice and then succeeds
      contributes 1 to total_jobs, not 3, matching Sidekiq Pro and GoodJob.
      Every attempt still gets its own tracking row, and the completion
      machinery is untouched.
    
    * Ship the batches schema as an optional migration until 2.0:
      `rails solid_queue:update` copies a migration guarded with
      if_not_exists throughout, so fresh installs (which get the tables
      with the base schema) can run it as a no-op. Until an app migrates,
      jobs run without batch bookkeeping, starting a batch raises with
      instructions, and the dispatcher logs a deprecation warning once per
      process. Includes a documented knob for building the jobs index
      concurrently on large PostgreSQL tables.
    
    * Finish empty batches at start instead of enqueueing an EmptyJob:
      starting a batch already ends by checking completion, so a batch
      with no jobs takes the same exit a fast-draining batch takes —
      callbacks fire right away, total_jobs stays honestly at zero, and no
      worker is needed.
    
    * Rebuild BatchExecution on top of Execution, reusing the base insert
      machinery, and reorganize Batch into Callbacks, Status, Clearable and
      Sweepable concerns around a start/finish/finalize lifecycle.
    
    * Split the batch sweep into named phases with self-describing metrics:
      stale_executions, finished_batches and started_batches, instead of
      repaired/size/started, which said nothing about what was counted.
    
    * Accept an explicit metadata: hash in Batch.enqueue, merging any extra
      keyword arguments into it.
    
    * Document why the batch completion re-check holds on every database:
      PostgreSQL's READ COMMITTED can let a blocked completion update win
      from a stale subquery snapshot — the re-check catches it with a fresh
      one — while MySQL reads DML subqueries from the latest committed
      data, so it can't win wrongly in the first place.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    rosa and claude committed Aug 21, 2026
    Configuration menu
    Copy the full SHA
    112bb1c View commit details
    Browse the repository at this point in the history
  3. Reset pooled connections when flipping the batches schema in tests

    Dropping and re-adding the jobs table's batch_id invalidates cached
    prepared statements whose SQL text didn't change, and PostgreSQL raises
    PreparedStatementCacheExpired when one is reused inside a transaction,
    where the adapter can't silently replan. Which statements are cached
    depends on which tests ran first, so this only failed on some CI seeds.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    2 people authored and rosa committed Aug 21, 2026
    Configuration menu
    Copy the full SHA
    5352228 View commit details
    Browse the repository at this point in the history
  4. Bump solid_queue to 1.7.0

    rosa committed Aug 21, 2026
    Configuration menu
    Copy the full SHA
    e2b5384 View commit details
    Browse the repository at this point in the history
Loading