Skip to content

Commit

Permalink
Update concurrency
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien <adrien@backslash.fr>
  • Loading branch information
adrienmo committed May 20, 2023
1 parent 04f7729 commit 2d4724c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

```
docker build -t evm_toolbox .
docker run -it --env PHX_HOST=localhost --env SECRET_KEY_BASE="F6DLslylCXON4ehdkPyzdrPxt3tiNuKvdTNpSa/tZMI2QvVvwuRXAwFVKBRyxRiS" -p 4000:4000 evm_toolbox
docker run -it --env MAX_CONCURRENCY=4 --env PHX_HOST=localhost --env SECRET_KEY_BASE="F6DLslylCXON4ehdkPyzdrPxt3tiNuKvdTNpSa/tZMI2QvVvwuRXAwFVKBRyxRiS" -p 4000:4000 evm_toolbox
```

You can now access to the tool via "http://localhost:4000"
You can now access to the tool via "http://localhost:4000"

For `linux/arm64/v8` Arch you can directly `docker pull adrienmo/evm_toolbox`
8 changes: 4 additions & 4 deletions lib/evm_toolbox/gas_analyzer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ defmodule EvmToolbox.GasAnalyzer do

@spec do_analyze(String.t(), pid(), fun()) :: :ok
def do_analyze(code, receiver, result_callback) do
path = create_project(code)

combinations = for version <- @versions, ir <- [true, false], do: {version, ir}
combinations = for ir <- [true, false], version <- @versions, do: {version, ir}
max_concurrency = System.get_env("MAX_CONCURRENCY", "1") |> String.to_integer()

Task.async_stream(
combinations,
fn {version, ir} ->
path = create_project(code)
{:ok, result} = analyze_version(version, ir, path)
send(receiver, result_callback.({version, ir, result}))
end,
ordered: false,
max_concurrency: 4,
max_concurrency: max_concurrency,
timeout: :infinity
)
|> Stream.run()
Expand Down

0 comments on commit 2d4724c

Please sign in to comment.