diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-05 12:34:05 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-05 12:34:05 +0300 |
commit | 3cc5e48668caf97588241001866fd42666b2f8f0 (patch) | |
tree | 03cf2c22213686fad5829b896f515ebe9beeef3c /app/services | |
parent | 3b39cf4e0c5d0ca680a40bb7232fee4f7fdfb02e (diff) | |
parent | 103b5bf60ba952e661b3e22d866cc64eed7358ee (diff) |
Merge branch 'sidekiq-transaction' into 'master'
Forbid Sidekiq scheduling in transactions
Closes #27233
See merge request !9376
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/destroy_service.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index 06d8d143231..e2b2660ea71 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -7,11 +7,9 @@ module Projects DELETED_FLAG = '+deleted'.freeze def async_execute - project.transaction do - project.update_attribute(:pending_delete, true) - job_id = ProjectDestroyWorker.perform_async(project.id, current_user.id, params) - Rails.logger.info("User #{current_user.id} scheduled destruction of project #{project.path_with_namespace} with job ID #{job_id}") - end + project.update_attribute(:pending_delete, true) + job_id = ProjectDestroyWorker.perform_async(project.id, current_user.id, params) + Rails.logger.info("User #{current_user.id} scheduled destruction of project #{project.path_with_namespace} with job ID #{job_id}") end def execute @@ -62,7 +60,11 @@ module Projects if gitlab_shell.mv_repository(project.repository_storage_path, path, new_path) log_info("Repository \"#{path}\" moved to \"#{new_path}\"") - GitlabShellWorker.perform_in(5.minutes, :remove_repository, project.repository_storage_path, new_path) + + project.run_after_commit do + # self is now project + GitlabShellWorker.perform_in(5.minutes, :remove_repository, self.repository_storage_path, new_path) + end else false end |