fix: back to at least part-parallism, except sqlite

This commit is contained in:
2026-04-25 19:24:51 +02:00
parent 7c73b984dc
commit 5c138d54b8
8 changed files with 278 additions and 100 deletions

16
lib/bds/rebuild.ex Normal file
View File

@@ -0,0 +1,16 @@
defmodule BDS.Rebuild do
@moduledoc false
def parallel_map(items, mapper, opts \\ []) when is_list(items) and is_function(mapper, 1) do
max_concurrency = Keyword.get(opts, :max_concurrency, System.schedulers_online())
ordered = Keyword.get(opts, :ordered, true)
timeout = Keyword.get(opts, :timeout, :infinity)
items
|> Task.async_stream(mapper, max_concurrency: max_concurrency, ordered: ordered, timeout: timeout)
|> Enum.map(fn
{:ok, item} -> item
{:exit, reason} -> exit(reason)
end)
end
end