summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-06-01 16:36:04 -0500
committerDouwe Maan <douwe@selenight.nl>2017-06-02 11:43:32 -0500
commite4eac1fff1ba6d890f9f028dbfe47918b7876688 (patch)
treef4f08e065ca769e34c0e2139765b268c192260d2 /app/models/namespace.rb
parenta9dbda8605f2c3111c4e4775edf7f931e4260a41 (diff)
downloadgitlab-ce-e4eac1fff1ba6d890f9f028dbfe47918b7876688.tar.gz
Don’t schedule workers from inside transactions
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index aebee06d560..b48d73dcae7 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -6,6 +6,7 @@ class Namespace < ActiveRecord::Base
include Gitlab::ShellAdapter
include Gitlab::CurrentSettings
include Routable
+ include AfterCommitQueue
# Prevent users from creating unreasonably deep level of nesting.
# The number 20 was taken based on maximum nesting level of
@@ -242,7 +243,9 @@ class Namespace < ActiveRecord::Base
# Remove namespace directroy async with delay so
# GitLab has time to remove all projects first
- GitlabShellWorker.perform_in(5.minutes, :rm_namespace, repository_storage_path, new_path)
+ run_after_commit do
+ GitlabShellWorker.perform_in(5.minutes, :rm_namespace, repository_storage_path, new_path)
+ end
end
end