@@ -222,16 +222,17 @@ func (h *Handlers) claimRunnerJob( |
| 222 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, nil | 222 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, nil |
| 223 | } | 223 | } |
| 224 | run, err := q.StartWorkflowRun(ctx, tx, job.RunID) | 224 | run, err := q.StartWorkflowRun(ctx, tx, job.RunID) |
| 225 | - if err == nil { | 225 | + switch { |
| | 226 | + case err == nil: |
| 226 | if err := actionsevents.EmitRunTx(ctx, tx, run, actionsevents.ActionRunning); err != nil { | 227 | if err := actionsevents.EmitRunTx(ctx, tx, run, actionsevents.ActionRunning); err != nil { |
| 227 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, err | 228 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, err |
| 228 | } | 229 | } |
| 229 | - } else if errors.Is(err, pgx.ErrNoRows) { | 230 | + case errors.Is(err, pgx.ErrNoRows): |
| 230 | run, err = q.GetWorkflowRunByID(ctx, tx, job.RunID) | 231 | run, err = q.GetWorkflowRunByID(ctx, tx, job.RunID) |
| 231 | if err != nil { | 232 | if err != nil { |
| 232 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, err | 233 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, err |
| 233 | } | 234 | } |
| 234 | - } else { | 235 | + default: |
| 235 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, err | 236 | return actionsdb.ClaimQueuedWorkflowJobRow{}, nil, nil, false, err |
| 236 | } | 237 | } |
| 237 | if err := actionsevents.EmitJobTx(ctx, tx, run, claimRowWorkflowJob(job), actionsevents.ActionRunning); err != nil { | 238 | if err := actionsevents.EmitJobTx(ctx, tx, run, claimRowWorkflowJob(job), actionsevents.ActionRunning); err != nil { |