Skip to content

Fix race error during MR rule sync operation

Bala Kumar requested to merge 415250-fix-race-in-sync-merge-request-rules into master

What does this MR do and why?

This MR implements a short-term solution to address the ActiveRecord::RecordInvalid: Validation failed: Name has already been taken error due to a race condition between process_scan_result_policy_worker and sync_opened_merge_request_worker. The error was described here.

The short-term solution described here, validates the approval_project_rules record when a approval_merge_request_rules is created. We will skip the approval_merge_request_rules creation if the approval_project_rule record no longer exists.

The MR's changes are behind a feature flag.

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 #415250 (closed)

Edited by Marcos Rocha

Merge request reports