Commit 52b3d7b
committed
Prevent blocked jobs from being released while job is still executing
When a job runs longer than its concurrency_duration, the semaphore
expires and gets deleted by the dispatcher's concurrency maintenance.
Previously, BlockedExecution.releasable would consider a concurrency
key releasable when its semaphore was missing, causing blocked jobs
to be released and run concurrently with the still-executing job.
This violated the concurrency guarantee: with limits_concurrency set
to 1, two jobs with the same concurrency key could run simultaneously
if the first job exceeded its concurrency_duration.
Fix: Check for claimed executions before marking a concurrency key as
releasable. A key is only releasable when:
- Its semaphore is missing OR has available slots, AND
- No jobs with that key are currently being executed (claimed)
This ensures concurrency limits are respected even when jobs exceed
their configured duration.1 parent 839ba64 commit 52b3d7b
File tree
2 files changed
+53
-1
lines changed- app/models/solid_queue
- test/integration
2 files changed
+53
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
39 | 47 | | |
40 | | - | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
165 | 208 | | |
166 | 209 | | |
167 | 210 | | |
| |||
0 commit comments