Skip to content

Commit

Permalink
fix: Improving Migrations error handling (#733)
Browse files Browse the repository at this point in the history
* Switched migration to be rest_for_all to avoid migrations from restarting constantly
* Added application_name to migrations to easily debug issues
* Changed backoff strategy on Migrations which will avoid exponential backoff and kill pid on fail
  • Loading branch information
filipecabaco authored Nov 9, 2023
1 parent e3fdd0b commit 96c11d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/extensions/postgres_cdc_rls/worker_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ defmodule Extensions.PostgresCdcRls.WorkerSupervisor do
}
]

Supervisor.init(children, strategy: :one_for_all, max_restarts: 10, max_seconds: 60)
Supervisor.init(children, strategy: :rest_for_one, max_restarts: 10, max_seconds: 60)
end
end
6 changes: 5 additions & 1 deletion lib/realtime/tenants/migrations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ defmodule Realtime.Tenants.Migrations do
password: pass,
username: user,
pool_size: 2,
socket_options: db_socket_opts
socket_options: db_socket_opts,
parameters: [
application_name: "realtime_migrations"
],
backoff_type: :stop
]
|> H.maybe_enforce_ssl_config(ssl_enforced)
|> Repo.with_dynamic_repo(fn repo ->
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
def project do
[
app: :realtime,
version: "2.25.26",
version: "2.25.27",
elixir: "~> 1.14.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 96c11d0

Please sign in to comment.