diff options
| author | Dylan Griffith <dyl.griffith@gmail.com> | 2019-08-13 15:18:59 +1000 |
|---|---|---|
| committer | Dylan Griffith <dyl.griffith@gmail.com> | 2019-08-13 15:18:59 +1000 |
| commit | dcdc04ab46f4be77db52454dc634593595ae7612 (patch) | |
| tree | 13931d2c770d00c4e52c7a7d9287762465c95652 /app/models/clusters | |
| parent | fa70d12f0372bffff12d4385d465fe4b1c8d7a8e (diff) | |
| download | gitlab-ce-dcdc04ab46f4be77db52454dc634593595ae7612.tar.gz | |
Fix performance issue in Helm#can_uninstall?65963-avoid-extra-query-allowed-to-uninstall
Calling #present? was causing a DB query to happen each time around the
loop. We only wanted to check for nil as it's nil in the first loop
around so there is no need for #present?
Diffstat (limited to 'app/models/clusters')
| -rw-r--r-- | app/models/clusters/applications/helm.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb index 3a175fec148..455cf200fbc 100644 --- a/app/models/clusters/applications/helm.rb +++ b/app/models/clusters/applications/helm.rb @@ -41,7 +41,7 @@ module Clusters extra_apps = Clusters::Applications::Helm.where('EXISTS (?)', klass.select(1).where(cluster_id: cluster_id)) - applications = applications.present? ? applications.or(extra_apps) : extra_apps + applications = applications ? applications.or(extra_apps) : extra_apps end !applications.exists? |
