Merge request get closed unexpectedly
This might be caused by a race condition in the Git::BranchPushService and UpdateMergeRequestWorker
When the Git::BranchPushService runs, we schedule a UpdateMergeRequestWorker.
Inside the UpdateMergeRequestWorker we call the MergeRequests::RefreshService which could be closing merge requests for which the branch does not exist.
However, we only invalidate the branch cache of the project in Git::BranchPushService#execute_related_hooks
after we've scheduled the UpdateMergeRequestWorker.
That could cause the merge request being closed, as we've seen in gitlab-com/gl-infra/production#1040 (closed)
Edited by Marin Jankovski