Browse Source

Fixed ci warnings

Richard Nienaber 11 years ago
parent
commit
ab6d8780a7

+ 9 - 10
frameworks/Ruby/rails/app/controllers/hello_world_controller.rb

@@ -9,18 +9,17 @@ class HelloWorldController < ApplicationController
   end
 
   def db
-    queries = (params[:queries] || 1).to_i
+    render :json => World.find(Random.rand(10000) + 1)
+  end
 
-    if queries > 1
-      results = (1..queries).map do
-        # get a random row from the database, which we know has 10000
-        # rows with ids 1 - 10000
-        World.find(Random.rand(10000) + 1)
-      end
-    else
-      results = World.find(Random.rand(10000) + 1)
-    end
+  def query
+    queries = params[:queries].to_i
+    queries = 1 if queries < 1
+    queries = 500 if queries > 500
 
+    results = (1..queries).map do
+      World.find(Random.rand(10000) + 1)
+    end
     render :json => results
   end
   

+ 6 - 6
frameworks/Ruby/rails/benchmark_config

@@ -5,7 +5,7 @@
       "setup_file": "run_jruby_puma",
       "json_url": "/hello_world/json",
       "db_url": "/hello_world/db",
-      "query_url": "/hello_world/db?queries=",
+      "query_url": "/hello_world/query?queries=",
       "fortune_url": "/fortune",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",
@@ -28,7 +28,7 @@
       "setup_file": "run_mri_puma",
       "json_url": "/hello_world/json",
       "db_url": "/hello_world/db",
-      "query_url": "/hello_world/db?queries=",
+      "query_url": "/hello_world/query?queries=",
       "fortune_url": "/fortune",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",
@@ -51,7 +51,7 @@
       "setup_file": "run_thin",
       "json_url": "/hello_world/json",
       "db_url": "/hello_world/db",
-      "query_url": "/hello_world/db?queries=",
+      "query_url": "/hello_world/query?queries=",
       "fortune_url": "/fortune",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",
@@ -74,7 +74,7 @@
       "setup_file": "run_torqbox",
       "json_url": "/hello_world/json",
       "db_url": "/hello_world/db",
-      "query_url": "/hello_world/db?queries=",
+      "query_url": "/hello_world/query?queries=",
       "fortune_url": "/fortune",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",
@@ -97,7 +97,7 @@
       "setup_file": "run_trinidad",
       "json_url": "/hello_world/json",
       "db_url": "/hello_world/db",
-      "query_url": "/hello_world/db?queries=",
+      "query_url": "/hello_world/query?queries=",
       "fortune_url": "/fortune",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",
@@ -120,7 +120,7 @@
       "setup_file": "run_unicorn",
       "json_url": "/hello_world/json",
       "db_url": "/hello_world/db",
-      "query_url": "/hello_world/db?queries=",
+      "query_url": "/hello_world/query?queries=",
       "fortune_url": "/fortune",
       "update_url": "/update?queries=",
       "plaintext_url": "/plaintext",

+ 1 - 0
frameworks/Ruby/rails/config/routes.rb

@@ -56,6 +56,7 @@ Rails.application.routes.draw do
 
   get "hello_world/json"
   get "hello_world/db"
+  get "hello_world/query"
   get "fortune" => "hello_world#fortune"
   get "update" => "hello_world#update"
   get "plaintext" => "hello_world#plaintext"