2018-06-27 07:23:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class DeleteMergedBranchesWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2016-09-21 14:15:12 +00:00
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 18:10:09 +00:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-10-18 11:11:44 +00:00
|
|
|
feature_category :source_code_management
|
|
|
|
|
2016-09-21 14:15:12 +00:00
|
|
|
def perform(project_id, user_id)
|
|
|
|
begin
|
|
|
|
project = Project.find(project_id)
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
user = User.find(user_id)
|
|
|
|
|
|
|
|
begin
|
2019-12-03 18:06:49 +00:00
|
|
|
::Branches::DeleteMergedService.new(project, user).execute
|
2016-09-21 14:15:12 +00:00
|
|
|
rescue Gitlab::Access::AccessDeniedError
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|