parent
19c9c664a0
commit
bc972f9566
@ -0,0 +1,23 @@ |
||||
defmodule Mix.Tasks.Scrape do |
||||
@moduledoc "Scrapes blocks from web3" |
||||
use Mix.Task |
||||
alias Explorer.Repo |
||||
alias Explorer.SkippedBlocks |
||||
alias Explorer.BlockImporter |
||||
|
||||
def run([]), do: run(1) |
||||
def run(count) do |
||||
[:postgrex, :ecto, :ethereumex, :tzdata] |
||||
|> Enum.each(&Application.ensure_all_started/1) |
||||
Repo.start_link() |
||||
|
||||
"#{count}" |
||||
|> String.to_integer() |
||||
|> SkippedBlocks.first() |
||||
|> Enum.shuffle() |
||||
|> Flow.from_enumerable() |
||||
|> Flow.map(&BlockImporter.download_block/1) |
||||
|> Flow.map(&BlockImporter.import/1) |
||||
|> Enum.to_list() |
||||
end |
||||
end |
Loading…
Reference in new issue