Fix race condition in concurrency limit queue draining

What does this MR do and why?

When concurrency_limit_eager_resume_processing is enabled, the resume_processing! method loops to drain the throttled queue in batches. However, the exclusive lease was not being renewed between iterations, allowing it to expire mid-operation.

If the lease expired while processing a batch, another process could obtain the lease and interfere with queue operations, causing jobs to be lost or duplicated.

Fix this by renewing the lease before each iteration of the loop, ensuring exclusive access to the queue throughout the entire draining operation.

References

Relates to https://gitlab.com/gitlab-org/gitlab/-/work_items/580466

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports

Loading