Fix warnings, remove analyzers and create fact for champion played game
ci / docker (push) Successful in 7m38s

This commit is contained in:
2024-06-06 20:20:45 +02:00
parent fe3d040978
commit 6dd8eea3d3
26 changed files with 92 additions and 402 deletions
@@ -1,11 +1,6 @@
defmodule Scrapper.MatchClassifier do
require Logger
@spec classify_match(%LoLAPI.Model.MatchResponse{}) :: nil
def classify_match(match = %LoLAPI.Model.MatchResponse{}) do
classify_match_by_queue(match.info.queueId)
end
def stream_classify_matches_by_queue(queue \\ 420, bucket \\ "ranked") do
Storage.MatchStorage.S3MatchStorage.stream_files("matches")
|> Stream.each(fn match ->
@@ -28,35 +23,4 @@ defmodule Scrapper.MatchClassifier do
match
end)
end
@spec classify_match_by_queue(String.t()) :: nil
def classify_match_by_queue("420") do
matches = Storage.MatchStorage.S3MatchStorage.list_files("matches")
total_matches = Enum.count(matches)
matches
|> Enum.with_index(fn match, index -> {match, index} end)
|> Scrapper.Parallel.peach(fn {match, index} ->
%{key: json_file} = match
[key | _] = String.split(json_file, ".")
response =
HTTPoison.get!("http://#{System.get_env("EX_AWS_ENDPOINT")}:9000/matches/#{key}.json", [],
timeout: 5000
)
%{"info" => %{"gameVersion" => gameVersion, "queueId" => queueId}} =
Poison.decode!(response.body)
if queueId == 420 do
Storage.MatchStorage.S3MatchStorage.store_match(key, response.body, "ranked", gameVersion)
Logger.info("Match at #{index} of #{total_matches} is classified")
end
match
end)
end
def classify_match_by_queue(_) do
end
end
@@ -66,6 +66,6 @@ defmodule Scrapper.Processor.MatchProcessor do
end)
end
def process_resp({:err, code}, match_id) do
def process_resp({:err, _code}, _match_id) do
end
end
@@ -1,5 +1,4 @@
defmodule Scrapper.Processor.PlayerProcessor do
alias Calendar.ISO
use Broadway
def start_link(_opts) do
@@ -19,7 +19,7 @@ defmodule Scrapper.Queue.MatchQueue do
LolAnalytics.Match.MatchRepo.get_match(match_id)
|> case do
nil -> GenServer.call(__MODULE__, {:queue_match, match_id})
match -> :already_processed
_match -> :already_processed
end
end