2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class ProjectDestroyWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2017-08-24 15:24:58 -04:00
|
|
|
include ExceptionBacktrace
|
2016-01-22 14:13:37 -05:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category :source_code_management
|
|
|
|
|
2016-01-22 14:13:37 -05:00
|
|
|
def perform(project_id, user_id, params)
|
2017-06-29 07:43:01 -04:00
|
|
|
project = Project.find(project_id)
|
2016-01-22 14:13:37 -05:00
|
|
|
user = User.find(user_id)
|
|
|
|
|
2016-08-03 19:45:06 -04:00
|
|
|
::Projects::DestroyService.new(project, user, params.symbolize_keys).execute
|
2017-07-06 09:43:07 -04:00
|
|
|
rescue ActiveRecord::RecordNotFound => error
|
2017-07-18 11:09:14 -04:00
|
|
|
logger.error("Failed to delete project (#{project_id}): #{error.message}")
|
2016-01-22 14:13:37 -05:00
|
|
|
end
|
|
|
|
end
|