Fix jobs left in stuck state
From: https://gitlab.com/groups/gitlab-operating-model/-/work_items/572#note_3199567667
It seems a bit odd that we have this in [`drop_helpers.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/eca4b0b6702f24067700e5b0595aedd88722d138/app/services/ci/stuck_builds/drop_helpers.rb#L22):
```ruby
def drop_stuck(builds, failure_reason:)
fetch(builds) do |build|
break unless build.stuck?
drop_build :stuck, build, failure_reason
end
end
```
It's using **break** instead of **next**. Do you know if this was intentional?
In theory, if there's even one non-stuck job ahead of a stuck job, the latter won't get dropped because of the early exit. However, for this to happen [each hour](https://gitlab.com/gitlab-org/gitlab/-/blob/eca4b0b6702f24067700e5b0595aedd88722d138/app/workers/stuck_ci_jobs_worker.rb#L18) for 24 times before being dropped by [`drop`](https://gitlab.com/gitlab-org/gitlab/-/blob/eca4b0b6702f24067700e5b0595aedd88722d138/app/services/ci/stuck_builds/drop_helpers.rb#L8) seems a bit unlikely :thinking:. Still, it _could_ technically account for jobs incorrectly being attributed to `outdated` rather than `stuck`.
issue