Skip to content
Snippets Groups Projects
Commit 15654eca authored by Stan Hu's avatar Stan Hu
Browse files

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
parents 4a2320a7 230f6910
No related branches found
No related tags found
1 merge request!5540Add a log message when a project is scheduled for destruction for debugging
Pipeline #
Loading
@@ -1164,7 +1164,10 @@ class Project < ActiveRecord::Base
Loading
@@ -1164,7 +1164,10 @@ class Project < ActiveRecord::Base
   
def schedule_delete!(user_id, params) def schedule_delete!(user_id, params)
# Queue this task for after the commit, so once we mark pending_delete it will run # 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) update_attribute(:pending_delete, true)
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment