diff --git a/dump.rdb b/dump.rdb index eab676b..0a8c29c 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/lib/tasks/scheduler.rake b/lib/tasks/scheduler.rake index 3d3fd12..8ce8fd0 100644 --- a/lib/tasks/scheduler.rake +++ b/lib/tasks/scheduler.rake @@ -30,24 +30,20 @@ namespace :fetch_champion_gg do items = RiotApi::RiotApi.get_items item_names = parse_names(items) Rails.cache.write(:items, item_names) - failures = [] + + threads = [] items.each do |_, item| - if item[:description] - begin + threads << Thread.new do + if item[:description] efficiency = LeagueThekevApi::LeagueThekevApi.get_item(item[:id]) item[:description] = format_description(item[:description]) item[:cost_analysis] = efficiency.with_indifferent_access[:data] - .first[:attributes] - rescue Exception => e - failures << { - id: item[:id], - error: e - } + .first[:attributes] + Rails.cache.write({ items: item[:name] }, item) end - Rails.cache.write({ items: item[:name] }, item) end end - binding.pry + threads.each { |thread| thread.join } puts 'Fetched item data from champion.gg' end