Skip to content

Commit

Permalink
Fix logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rados13 committed Mar 18, 2024
1 parent e14f65a commit e3c202c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/recording_converter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ defmodule RecordingConverter do
with :ok <- send_files_without_index(),
{:ok, objects} <- get_bucket_objects(),
objects <- fetch_bucket_objects_name(objects),
true <- check_s3_bucket_and_local_equals?([@index_file | objects]),
true <- check_s3_bucket_and_local_equals?(objects),
{:ok, _value} <- send_file(@index_file) do
terminate(0)
{:stop, :normal, state}
Expand All @@ -91,12 +91,12 @@ defmodule RecordingConverter do
files =
output_directory()
|> File.ls!()
|> Enum.reject(&String.ends_with?(&1, @index_file))

Logger.info("Files to send: #{files}")
Logger.info("Files to send: #{Enum.join(files, " ")}")

{_succeses, failures} =
files
|> Enum.reject(&String.ends_with?(&1, @index_file))
|> Enum.map(&send_file(&1))
|> Enum.split_with(fn
{:ok, _value} -> true
Expand Down Expand Up @@ -128,7 +128,8 @@ defmodule RecordingConverter do
end

defp check_s3_bucket_and_local_equals?(objects) do
local_files = output_directory() |> File.ls!()
local_files =
output_directory() |> File.ls!() |> Enum.reject(&String.ends_with?(&1, @index_file))

remote_files = MapSet.new(objects)

Expand All @@ -140,7 +141,7 @@ defmodule RecordingConverter do
unless result?,
do:
Logger.error(
"Files on bucket and locally are not the same, \nlocal: #{local_files},\nremote: #{objects}"
"Files on bucket and locally are not the same, \nlocal: #{Enum.join(local_files, " ")},\nremote: #{Enum.join(objects, " ")}"
)

result?
Expand Down

0 comments on commit e3c202c

Please sign in to comment.