Skip to content

Allow mergeability check when merge_status is already checking

What does this MR do and why?

We previously don't perform MergeRequestMergeabilityCheckWorker when MR merge_status is already checking. This is to reduce the number of workers getting enqueued.

However, this can cause a MR getting stuck in checking state in case the worker failed to update the status (e.g. service failed to obtain a lock). The worker won't be retried because we handle and log this type of errors.

Since the worker is idempotent, it's already deduplicated. We also have a lease mechanism in MergeRequests::MergeabilityCheckService that will obtain a lock and keep it for a minute.

We can rely on these mechanisms instead so we can still allow performing a mergeability check when the merge_status is already checking.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. View a mergeable MR.

  2. Mark the MR as checking manually via Rails console:

    merge_request.mark_as_unchecked
    merge_request.mark_as_checking
  3. Reload the MR page and it should be mergeable.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #351728 (closed)

Merge request reports