From 7489629282bb95531303bb5546a698a331a009ae Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 9 Apr 2019 13:29:55 +0200 Subject: [PATCH] remove no longer used benchmark code. #224 --- app/controllers/concerns/facetable.rb | 34 +++++++++++---------------- app/controllers/dois_controller.rb | 5 +--- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/app/controllers/concerns/facetable.rb b/app/controllers/concerns/facetable.rb index 1d47dd1d8..6c1e6831c 100644 --- a/app/controllers/concerns/facetable.rb +++ b/app/controllers/concerns/facetable.rb @@ -132,26 +132,20 @@ def prefixes_totals(arr) def clients_totals(arr) logger = Logger.new(STDOUT) - clients = nil - logger.info "[Benchmark] clients_totals find_by_ids " + Benchmark.ms { - clients = Client.all.pluck(:symbol, :name).to_h - }.to_s + " ms" - - logger.info "[Benchmark] clients_totals map " + Benchmark.ms { - arr = arr.map do |hsh| - { "id" => hsh["key"], - "title" => clients[hsh["key"].upcase], - "count" => hsh["doc_count"], - "temporal" => { - "this_month" => facet_anual(hsh.this_month.buckets), - "this_year" => facet_anual(hsh.this_year.buckets), - "last_year" => facet_anual(hsh.last_year.buckets) - }, - "states" => facet_by_key(hsh.states.buckets) - } - end - }.to_s + " ms" - arr + clients = Client.all.pluck(:symbol, :name).to_h + + arr = arr.map do |hsh| + { "id" => hsh["key"], + "title" => clients[hsh["key"].upcase], + "count" => hsh["doc_count"], + "temporal" => { + "this_month" => facet_anual(hsh.this_month.buckets), + "this_year" => facet_anual(hsh.this_year.buckets), + "last_year" => facet_anual(hsh.last_year.buckets) + }, + "states" => facet_by_key(hsh.states.buckets) + } + end end def facet_by_provider_ids(arr) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 5348232ce..d6765ad98 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -90,10 +90,7 @@ def index total = sample_dois.length total_pages = 1 else - results = nil - logger.info "[Benchmark] results " + Benchmark.ms { - results = response.results - }.to_s + " ms" + results = response.results total = response.results.total total_for_pages = page[:cursor].present? ? total.to_f : [total.to_f, 10000].min total_pages = page[:size] > 0 ? (total_for_pages / page[:size]).ceil : 0