summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2017-06-29 12:43:01 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2017-07-20 09:59:56 +0100
commit3491b19a4e67a9f439c12afac45ef38f3fce0ef5 (patch)
treea548a111e88c046315e0a2633aba5656be7603ba /app/workers
parentf0e4e3993b1f5a21ab61aaff95f73ac4e5b88ad3 (diff)
downloadgitlab-ce-3491b19a4e67a9f439c12afac45ef38f3fce0ef5.tar.gz
Add specs for ProjectDestroyWorker
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/project_destroy_worker.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/app/workers/project_destroy_worker.rb b/app/workers/project_destroy_worker.rb
index 482e1e38cd1..209cf11e893 100644
--- a/app/workers/project_destroy_worker.rb
+++ b/app/workers/project_destroy_worker.rb
@@ -3,17 +3,14 @@ class ProjectDestroyWorker
include DedicatedSidekiqQueue
def perform(project_id, user_id, params)
- begin
- project = Project.unscoped.find(project_id)
- rescue ActiveRecord::RecordNotFound
- return
- end
-
+ project = Project.find(project_id)
user = User.find(user_id)
::Projects::DestroyService.new(project, user, params.symbolize_keys).execute
- rescue StandardError => error
- project.assign_attributes(delete_error: error.message, pending_delete: false)
- project.save!(validate: false)
+ rescue Exception => error # rubocop:disable Lint/RescueException
+ project&.update_attributes(delete_error: error.message, pending_delete: false)
+ Rails.logger.error("Deletion failed on #{project&.full_path} with the following message: #{error.message}")
+
+ raise
end
end