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.7.1
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.2
Choose a head ref
  • 6 commits
  • 10 files changed
  • 2 contributors

Commits on Nov 3, 2026

  1. Give concurrency slots back only to the semaphore they came from

    A semaphore counts free slots but doesn't know which jobs hold them, so
    any job that gave a slot back by key counted as a holder:
    
    - A job that ran past its duration gave its slot back to the semaphore
      created after its own expired, letting another job start while the
      new holder was still running (#827).
    - A job dispatched while its class was missing skipped its limits, but
      gave a slot back if it later ran where its class loads.
    - A job whose class was missing when it ran couldn't give back the slot
      it got when it was dispatched (#825).
    
    Now a job records the id of the semaphore it got a slot on, and its
    limit, in its serialized Active Job data, and gives the slot back only
    to that semaphore. A job that skips its limits records that it holds
    no slot. Jobs that got their slot before this change have nothing
    recorded and keep giving it back by key, until 2.0.
    
    The first two tests come from the reproduction in #827.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    rosa and claude committed Nov 3, 2026
    Configuration menu
    Copy the full SHA
    62c2927 View commit details
    Browse the repository at this point in the history
  2. Read the acquired semaphore with a lock, and record the limit used

    On MySQL with REPEATABLE READ, a plain read after taking a slot uses the
    transaction's snapshot, which can still include a semaphore that expired
    and was deleted after the snapshot was taken, so the job could record
    that one instead of the semaphore it just created. A locking read sees
    the latest committed rows.
    
    A job that keeps its concurrency key after its class drops
    limits_concurrency takes its slot with a limit of 1, so record that
    rather than nil, which failed to give the slot back if the class was
    also missing when the job ran.
    
    Also cover jobs sharing a semaphore, discarding ready jobs one by one
    and in bulk, and retried jobs, and explain the change in UPGRADING.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    rosa and claude committed Nov 3, 2026
    Configuration menu
    Copy the full SHA
    50ca656 View commit details
    Browse the repository at this point in the history
  3. Place the semaphore note under 1.7.2 in UPGRADING

    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    rosa and claude committed Nov 3, 2026
    Configuration menu
    Copy the full SHA
    6af5101 View commit details
    Browse the repository at this point in the history
  4. Test that a job records the semaphore it created on MySQL, and correc…

    …t the upgrade note
    
    A plain read inside a REPEATABLE READ transaction can still see a
    semaphore deleted after the transaction's snapshot, so without the
    locking read the job would record that one. The test fails without it.
    
    A slot that isn't given back comes back only when its semaphore expires,
    and every job taking or giving back a slot for the same key pushes that
    out, so on a busy key with a limit above 1 it may not come back for a
    long time. Say so in UPGRADING instead of promising it comes back after
    duration.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    rosa and claude committed Nov 3, 2026
    Configuration menu
    Copy the full SHA
    310496a View commit details
    Browse the repository at this point in the history
  5. Let the job answer for the concurrency slot it holds

    concurrency_limited? now just means the job has a concurrency key, as on
    the Active Job side, and the code checks for a missing class where that
    matters. The job exposes the semaphore it got its slot from and the
    limit it got it with, so the semaphore asks for those instead of
    reading the recorded data itself.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    rosa and claude committed Nov 3, 2026
    Configuration menu
    Copy the full SHA
    8b2a87b View commit details
    Browse the repository at this point in the history
  6. Bump solid_queue to 1.7.2

    rosa committed Nov 3, 2026
    Configuration menu
    Copy the full SHA
    b9c646a View commit details
    Browse the repository at this point in the history
Loading