Skip to content

Commit

Permalink
Merge branch 'Eein-1058/fix-slow-multicore-performance'
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Dec 6, 2023
2 parents e563af9 + a96ea76 commit 46c5ba5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 132 deletions.
7 changes: 5 additions & 2 deletions lib/credo/check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,11 @@ defmodule Credo.Check do

defp do_run_on_all_source_files(exec, source_files, params) do
source_files
|> Enum.map(&Task.async(fn -> run_on_source_file(exec, &1, params) end))
|> Enum.each(&Task.await(&1, :infinity))
|> Task.async_stream(fn source -> run_on_source_file(exec, source, params) end,
max_concurrency: exec.max_concurrent_check_runs,
timeout: :infinity
)
|> Stream.run()

:ok
end
Expand Down
11 changes: 8 additions & 3 deletions lib/credo/check/runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ defmodule Credo.Check.Runner do
|> warn_about_ineffective_patterns(exec)
|> fix_deprecated_notation_for_checks_without_params()

Credo.Check.Worker.run(check_tuples, exec.max_concurrent_check_runs, fn check_tuple ->
run_check(exec, check_tuple)
end)
check_tuples
|> Task.async_stream(
fn check_tuple ->
run_check(exec, check_tuple)
end,
timeout: :infinity
)
|> Stream.run()

:ok
end
Expand Down
126 changes: 0 additions & 126 deletions lib/credo/check/worker.ex

This file was deleted.

4 changes: 3 additions & 1 deletion lib/credo/execution.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ defmodule Credo.Execution do
enable_disabled_checks: nil,
ignore_checks_tags: [],
ignore_checks: nil,
max_concurrent_check_runs: nil,
min_priority: 0,
mute_exit_status: false,
only_checks_tags: [],
only_checks: nil,
read_from_stdin: false,

# This is no longer used, but we keep it so existing plugins that use it don't break
max_concurrent_check_runs: nil,

# state, which is accessed and changed over the course of Credo's execution
pipeline_map: %{},
commands: %{},
Expand Down

0 comments on commit 46c5ba5

Please sign in to comment.