Fix AutoMergeProcessWorker raises an error for merged MRs
What does this MR do?
This MR fixes the exception report => #121989 (closed).
Confirmed that the problem can be reproduced by the following steps:
- Multiple pipelines finished simulteniously in multiple MRs
- Each pipeline invokes
AutoMergeProcessWorker
to refresh and merge merge requests on train. - Since
RefreshMergeRequestsService
is concurrent-safe architecture, it exclusively locks the process with one of the MRs. The rest of the items are enqueued and waiting until the currently-running process finished. - After the currently-running process finished, it refreshes the other MRs, but it's already processed (merged) at the 3., it's no longer processible, thus raises an error.
This means Merge Train is functional however causing unnecessary exceptions and triggering sidekiq retry.
Close #121989 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda