Skip to content

Commit 62cd766

Browse files
committed
update oban config
1 parent cd69e77 commit 62cd766

File tree

6 files changed

+7
-45
lines changed

6 files changed

+7
-45
lines changed

config/config.exs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ config :algora, AlgoraWeb.Endpoint,
4141

4242
config :algora, Oban,
4343
notifier: Oban.Notifiers.PG,
44-
repo: Algora.ObanRepo,
45-
get_dynamic_repo: {Algora.Repo, :oban_repo, []},
44+
repo: Algora.Repo,
4645
queues: [
47-
default: 1,
48-
background: 1,
49-
internal: 1,
50-
internal_par: 5
46+
default: [limit: 1, dispatch_cooldown: 5],
47+
background: [limit: 1, dispatch_cooldown: 50],
48+
internal: [limit: 1, dispatch_cooldown: 100],
49+
internal_par: [limit: 1, dispatch_cooldown: 500]
5150
]
5251

5352
# Configures the mailer

config/dev.exs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ config :algora, Algora.Repo,
3333
migration_primary_key: [type: :string],
3434
migration_timestamps: [type: :utc_datetime_usec]
3535

36-
# Configure dedicated Oban database repository
37-
config :algora, Algora.ObanRepo,
38-
url: System.get_env("DATABASE_URL"),
39-
stacktrace: true,
40-
show_sensitive_data_on_connection_error: true,
41-
pool_size: 10,
42-
migration_primary_key: [type: :string],
43-
migration_timestamps: [type: :utc_datetime_usec]
44-
4536
config :ex_aws,
4637
json_codec: Jason,
4738
access_key_id: System.get_env("AWS_ACCESS_KEY_ID"),

config/runtime.exs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,10 @@ if config_env() == :prod do
5555
config :algora, Algora.Repo,
5656
# ssl: true,
5757
url: database_url,
58-
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
58+
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "20"),
5959
socket_options: maybe_ipv6,
6060
migration_primary_key: [type: :string],
61-
migration_timestamps: [type: :utc_datetime_usec],
62-
queue_target: 5000
63-
64-
# Configure dedicated Oban database repository
65-
config :algora, Algora.ObanRepo,
66-
# ssl: true,
67-
url: database_url,
68-
pool_size: String.to_integer(System.get_env("OBAN_POOL_SIZE") || "10"),
69-
socket_options: maybe_ipv6,
70-
migration_primary_key: [type: :string],
71-
migration_timestamps: [type: :utc_datetime_usec],
72-
queue_target: 5000
61+
migration_timestamps: [type: :utc_datetime_usec]
7362

7463
config :ex_aws,
7564
json_codec: Jason,

config/test.exs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ config :algora, Algora.Repo,
1212
migration_primary_key: [type: :string],
1313
migration_timestamps: [type: :utc_datetime_usec]
1414

15-
# Configure dedicated Oban database repository for testing
16-
config :algora, Algora.ObanRepo,
17-
url: System.get_env("TEST_DATABASE_URL"),
18-
pool: Ecto.Adapters.SQL.Sandbox,
19-
pool_size: System.schedulers_online() * 2,
20-
migration_primary_key: [type: :string],
21-
migration_timestamps: [type: :utc_datetime_usec]
22-
2315
# We don't run a server during test. If one is required,
2416
# you can enable the server option below.
2517
config :algora, AlgoraWeb.Endpoint,

lib/algora/application.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ defmodule Algora.Application do
1414
{NodeJS.Supervisor, [path: LiveSvelte.SSR.NodeJS.server_path(), pool_size: 4]},
1515
AlgoraWeb.Telemetry,
1616
Algora.Repo,
17-
Algora.ObanRepo,
1817
{Oban, Application.fetch_env!(:algora, Oban)},
1918
{DNSCluster, query: Application.get_env(:algora, :dns_cluster_query) || :ignore},
2019
{Phoenix.PubSub, name: Algora.PubSub},

lib/algora/repo.ex

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ defmodule Algora.Repo do
33
otp_app: :algora,
44
adapter: Ecto.Adapters.Postgres
55

6-
def oban_repo do
7-
if in_transaction?() do
8-
__MODULE__
9-
else
10-
Algora.ObanRepo
11-
end
12-
end
13-
146
alias Algora.Activities.Activity
157
alias Algora.Activities.Notifier
168

0 commit comments

Comments
 (0)