summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-07-28 17:16:37 +0000
committerRémy Coutable <remy@rymai.me>2016-08-01 15:29:31 +0200
commit24bf2434dd1339b75fe405834f5281422e7d1b6b (patch)
treea55a7a5228639048505a1fd24f6d4f247417c016
parenta4dbb3efdc60682e42cf085f28c993bccbb47310 (diff)
downloadgitlab-ce-24bf2434dd1339b75fe405834f5281422e7d1b6b.tar.gz
Merge branch 'log-project-deletion' into 'master'
Add a log message when a project is scheduled for destruction for debugging We have a lot of projects that are in `pending_delete` state. It's not clear whether they were ever scheduled for destruction, or whether Sidekiq just dropped the job due to `MemoryKiller` or some other reason. Also this will provide a record of which user destroys a project. #20365 See merge request !5540 Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/project.rb5
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8285acc8c9d..fab9470bca5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.10.3 (unreleased)
- Fix Import/Export issue importing milestones and labels not associated properly. !5426
- Fix timing problems running imports on production. !5523
+ - Add a log message when a project is scheduled for destruction for debugging. !5540
v 8.10.2
- User can now search branches by name. !5144
diff --git a/app/models/project.rb b/app/models/project.rb
index e7cee6a6942..14ecaa27844 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1144,7 +1144,10 @@ class Project < ActiveRecord::Base
def schedule_delete!(user_id, params)
# Queue this task for after the commit, so once we mark pending_delete it will run
- run_after_commit { ProjectDestroyWorker.perform_async(id, user_id, params) }
+ run_after_commit do
+ job_id = ProjectDestroyWorker.perform_async(id, user_id, params)
+ Rails.logger.info("User #{user_id} scheduled destruction of project #{path_with_namespace} with job ID #{job_id}")
+ end
update_attribute(:pending_delete, true)
end