diff --git a/config/config.exs b/config/config.exs index 6ba9220..724056e 100644 --- a/config/config.exs +++ b/config/config.exs @@ -8,7 +8,9 @@ import Config config :ocrlot, - generators: [timestamp_type: :utc_datetime] + generators: [timestamp_type: :utc_datetime], + # Each worker can take ~120Mib + extractor_max_workers: String.to_integer(System.get_env("EXTRACTOR_MAX_WORKERS") || "1") # Configures the endpoint config :ocrlot, OcrlotWeb.Endpoint, diff --git a/lib/ocrlot/extractor/worker_pool.ex b/lib/ocrlot/extractor/worker_pool.ex index 4ec6552..e9d8a27 100644 --- a/lib/ocrlot/extractor/worker_pool.ex +++ b/lib/ocrlot/extractor/worker_pool.ex @@ -50,7 +50,5 @@ defmodule Ocrlot.Extractor.WorkerPool do defp round_robin(0), do: {:error, :no_workers_available} - # defp max_children(), do: Application.fetch_env!(:guava, :concurent_task_limit) - def max_children(), do: 3 - # defp max_retries(), do: 3 + defp max_children(), do: Application.fetch_env!(:ocrlot, :extractor_max_workers) |> dbg() end