summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Stark <stark@gitlab.com>2017-12-05 19:26:02 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2017-12-12 17:50:26 +0100
commit946d87d332232e1b4bceeac44ce89d8fd645166e (patch)
treef61ecf9868804f871736b827f8cc00bc915d8cf3
parentad1c186ed386afab578668ccdc21cb02354c81bc (diff)
downloadgitlab-ce-946d87d332232e1b4bceeac44ce89d8fd645166e.tar.gz
check the import_status field before doing SQL operations to check the import url
-rw-r--r--app/models/project.rb3
-rw-r--r--changelogs/unreleased/optimize-projects-for-imported-projects.yml6
2 files changed, 8 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4c4ec2226ad..5183a216c53 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -659,7 +659,8 @@ class Project < ActiveRecord::Base
end
def import_started?
- import? && import_status == 'started'
+ # import? does SQL work so only run it if it looks like there's an import running
+ import_status == 'started' && import?
end
def import_scheduled?
diff --git a/changelogs/unreleased/optimize-projects-for-imported-projects.yml b/changelogs/unreleased/optimize-projects-for-imported-projects.yml
new file mode 100644
index 00000000000..13186fa36d5
--- /dev/null
+++ b/changelogs/unreleased/optimize-projects-for-imported-projects.yml
@@ -0,0 +1,6 @@
+---
+title: check the import_status field before doing SQL operations to check the import
+ url
+merge_request:
+author:
+type: performance