debian-mirror-gitlab/app/workers/project_destroy_worker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
605 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
2023-05-27 22:25:52 +05:30
class ProjectDestroyWorker
2018-03-17 18:26:18 +05:30
include ApplicationWorker
2021-06-08 01:23:25 +05:30
2021-10-27 15:23:28 +05:30
data_consistency :always
2021-06-08 01:23:25 +05:30
sidekiq_options retry: 3
2018-03-17 18:26:18 +05:30
include ExceptionBacktrace
2016-04-02 18:10:28 +05:30
2019-12-21 20:55:43 +05:30
feature_category :source_code_management
2023-05-27 22:25:52 +05:30
idempotent!
deduplicate :until_executed, ttl: 2.hours
2016-04-02 18:10:28 +05:30
def perform(project_id, user_id, params)
2017-09-10 17:25:29 +05:30
project = Project.find(project_id)
2016-04-02 18:10:28 +05:30
user = User.find(user_id)
2016-09-13 17:45:13 +05:30
::Projects::DestroyService.new(project, user, params.symbolize_keys).execute
2017-09-10 17:25:29 +05:30
rescue ActiveRecord::RecordNotFound => error
logger.error("Failed to delete project (#{project_id}): #{error.message}")
2016-04-02 18:10:28 +05:30
end
end