Skip to content

Fix #retry_lock overriding .current_scope

Hordur Freyr Yngvason requested to merge fix-retry-lock-current-scope into master

What does this MR do and why?

First part of #391186 (closed)

Resolves an issue with Gitlab::OptimisticLocking#retry_lock, where calling it with a an ActiveRecord::Relation would override the underlying model's current scope.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Run the added testcase without the fix. Observe that it fails
  2. Run the added testcase with the fix. Observe that it succeeds.

MR acceptance checklist

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

Merge request reports