diff options
Diffstat (limited to 'app/workers/merge_requests')
-rw-r--r-- | app/workers/merge_requests/delete_branch_worker.rb | 27 | ||||
-rw-r--r-- | app/workers/merge_requests/delete_source_branch_worker.rb | 9 |
2 files changed, 5 insertions, 31 deletions
diff --git a/app/workers/merge_requests/delete_branch_worker.rb b/app/workers/merge_requests/delete_branch_worker.rb deleted file mode 100644 index 6816f9a4b77..00000000000 --- a/app/workers/merge_requests/delete_branch_worker.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module MergeRequests - class DeleteBranchWorker - include ApplicationWorker - - data_consistency :always - - feature_category :source_code_management - urgency :high - idempotent! - - def perform(merge_request_id, user_id, branch_name, retarget_branch) - merge_request = MergeRequest.find_by_id(merge_request_id) - user = User.find_by_id(user_id) - - return unless merge_request.present? && user.present? - - ::Branches::DeleteService.new(merge_request.source_project, user).execute(branch_name) - - return unless retarget_branch - - ::MergeRequests::RetargetChainService.new(project: merge_request.source_project, current_user: user) - .execute(merge_request) - end - end -end diff --git a/app/workers/merge_requests/delete_source_branch_worker.rb b/app/workers/merge_requests/delete_source_branch_worker.rb index 96dde413d5b..da1eca067a9 100644 --- a/app/workers/merge_requests/delete_source_branch_worker.rb +++ b/app/workers/merge_requests/delete_source_branch_worker.rb @@ -19,13 +19,14 @@ class MergeRequests::DeleteSourceBranchWorker return if merge_request.source_branch_sha != source_branch_sha if Feature.enabled?(:add_delete_branch_worker, merge_request.source_project) - ::MergeRequests::DeleteBranchWorker.perform_async(merge_request_id, user_id, merge_request.source_branch, true) + ::Projects::DeleteBranchWorker.new.perform(merge_request.source_project.id, user_id, + merge_request.source_branch) else ::Branches::DeleteService.new(merge_request.source_project, user).execute(merge_request.source_branch) - - ::MergeRequests::RetargetChainService.new(project: merge_request.source_project, current_user: user) - .execute(merge_request) end + + ::MergeRequests::RetargetChainService.new(project: merge_request.source_project, current_user: user) + .execute(merge_request) rescue ActiveRecord::RecordNotFound end end |