Skip to content

Commit

Permalink
stamp: loading max workers config from env
Browse files Browse the repository at this point in the history
  • Loading branch information
kallebysantos committed Jan 21, 2025
1 parent 0867d19 commit d063e7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions lib/ocrlot/extractor/worker_pool.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d063e7a

Please sign in to comment.