diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2016-11-16 14:46:07 +0300 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2016-11-16 14:46:07 +0300 |
commit | ef3be00a0297dfa31002616df6ee49a0e2132cb7 (patch) | |
tree | 2316894b87a84db4ecb8ddcd96eba046aeb2a47b /app/services | |
parent | 0f48abf24b0ba34aebfc1d0d52e9e22648b7da1a (diff) |
Defer saving project services to the database if there are no user changes
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/create_service.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 15d7918e7fd..28db145a1f4 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -95,7 +95,7 @@ module Projects unless @project.gitlab_project_import? @project.create_wiki unless skip_wiki? - @project.build_missing_services + create_services_from_active_templates(@project) @project.create_labels end @@ -135,5 +135,12 @@ module Projects @project end + + def create_services_from_active_templates(project) + Service.where(template: true, active: true).each do |template| + service = Service.build_from_template(project.id, template) + service.save! + end + end end end |