Skip to content

Commit

Permalink
Revert "Add logging to repo_helper to get timing info."
Browse files Browse the repository at this point in the history
This reverts commit 24bc5bc.
  • Loading branch information
rkachowski committed Jan 25, 2024
1 parent 245b6db commit 808db90
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions apps/explorer/lib/explorer/repo/repo_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,16 @@ defmodule Explorer.Repo.RepoHelper do

chunk_size = Keyword.get(opts, :chunk_size, @chunk_size)

chunks = ceil(length(elements) / chunk_size)
if chunks > 1 do
Logger.info("!!!! safe_insert_all #{kind |> to_string()} chunks #{chunks}")
end

global_insert_start = System.monotonic_time()

elements
|> Enum.chunk_every(chunk_size)
|> Enum.reduce({0, []}, fn chunk, {total_count, acc} ->
local_insert_start = System.monotonic_time()

{count, inserted} =
try do
result = __MODULE__.insert_all(kind, chunk, opts)
if chunks > 1 do
local_insert_end = System.monotonic_time()
Logger.info("!!!! inserted #{kind |> to_string()} in #{local_insert_end - local_insert_start} (global #{local_insert_end - global_insert_start})")
end
result
__MODULE__.insert_all(kind, chunk, opts)
rescue
exception ->
old_truncate = Application.get_env(:logger, :truncate)
Logger.configure(truncate: :infinity)
failed = System.monotonic_time()
Logger.info("!!!! failed #{kind |> to_string()} in #{failed - local_insert_start} (global #{failed - global_insert_start})")

Logger.error(fn ->
[
Expand Down

0 comments on commit 808db90

Please sign in to comment.