Skip to content

Commit ab03ce5

Browse files
committed
Fix pool size
1 parent 7134482 commit ab03ce5

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

apps/codebattle/lib/codebattle/utils/release.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,23 @@ defmodule Codebattle.Utils.Release do
77
Application.ensure_all_started(:ssl)
88

99
for repo <- repos() do
10-
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
10+
{:ok, _, _} =
11+
Ecto.Migrator.with_repo(
12+
repo,
13+
&Ecto.Migrator.run(&1, :up, all: true),
14+
pool_size: migration_pool_size()
15+
)
1116
end
1217
end
1318

1419
defp repos do
1520
Application.load(@app)
1621
Application.fetch_env!(@app, :ecto_repos)
1722
end
23+
24+
defp migration_pool_size do
25+
"CODEBATTLE_MIGRATION_POOL_SIZE"
26+
|> System.get_env("2")
27+
|> String.to_integer()
28+
end
1829
end

config/runtime.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if config_env() == :prod do
4343
password: System.get_env("CODEBATTLE_DB_PASSWORD"),
4444
hostname: System.get_env("CODEBATTLE_DB_HOSTNAME"),
4545
database: System.get_env("CODEBATTLE_DB_NAME"),
46-
pool_size: "CODEBATTLE_POOL_SIZE" |> System.get_env("20") |> String.to_integer(),
46+
pool_size: "CODEBATTLE_POOL_SIZE" |> System.get_env("10") |> String.to_integer(),
4747
queue_target: "CODEBATTLE_DB_QUEUE_TARGET" |> System.get_env("2000") |> String.to_integer(),
4848
queue_interval: "CODEBATTLE_DB_QUEUE_INTERVAL" |> System.get_env("5000") |> String.to_integer(),
4949
log_level: :error

0 commit comments

Comments
 (0)