Permalink
Browse files

perfectsecs shouldn't be parallelized

  • Loading branch information...
sorah committed Oct 31, 2015
1 parent 9d89d15 commit f47db23fc9f7b847518ca8edb587b741e946570f
Showing with 17 additions and 1 deletion.
  1. +17 −1 5f/webapp/ruby/app.rb
View
@@ -410,15 +410,31 @@ def fetch_api(method, uri, headers, params)
arg = get_subscription(user[:id])
+ perfectsecs = []
data = arg.map do |service, conf|
+ if service == 'perfectsec' || service == 'perfectsec_attacked'
+ perfectsecs << [service, conf]
+ next
+ end
Expeditor::Command.new do
endpoint = Isucon5f::Endpoint.get(service)
{"service" => service, "data" => endpoint.fetch_with_cache(conf, redis)}
end
+ end.compact
+
+ unless perfectsecs.empty?
+ data.push(
+ Expeditor::Command.new do
+ perfectsecs.map do |service, conf|
+ endpoint = Isucon5f::Endpoint.get(service)
+ {"service" => service, "data" => endpoint.fetch_with_cache(conf, redis)}
+ end
+ end
+ )
end
data.each(&:start)
- json data.map(&:get)
+ json data.map(&:get).flatten
end
get '/spoof' do

0 comments on commit f47db23

Please sign in to comment.