]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6584 WS api/resources/index fix when no measure returned
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 3 Feb 2016 11:29:24 +0000 (12:29 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 3 Feb 2016 11:29:24 +0000 (12:29 +0100)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb

index 45b650b7eaea0c22410a2ce2599e3a1f4410d1b5..5b7e125356cf570c1715b184342564242e77cc97 100644 (file)
@@ -123,8 +123,7 @@ class Api::ResourcesController < Api::ApiController
       measures_conditions=[]
       measures_values={}
       measures_order = nil
-      # SONAR-6584 avoid OOM errors
-      measures_limit = 10000
+      measures_limit = nil
       measures_by_sid={}
       measures=nil
       rules_by_id=nil
@@ -192,7 +191,8 @@ class Api::ResourcesController < Api::ApiController
                                      :select => select_columns_for_measures,
                                      :conditions => [(snapshots_conditions + measures_conditions).join(' AND '), snapshots_values.merge(measures_values)],
                                      :order => measures_order,
-                                     :limit => measures_limit)
+                                     # SONAR-6584 avoid OOM errors
+                                     :limit => measures_limit ? measures_limit : 10000)
 
         measures.each do |measure|
           measures_by_sid[measure.snapshot_id]||=[]