Skip to content

Commit

Permalink
fix: Healthcheck improperly calling postgrex (#1219)
Browse files Browse the repository at this point in the history
Currently postgrex was trying to call a pid that was from another node which is not capable to do. We need to wrap it around Realtime.Database.transaction to run the erpc call against the target node
  • Loading branch information
filipecabaco authored Nov 12, 2024
1 parent 61907d3 commit 5dafe26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/realtime/tenants/migrations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ defmodule Realtime.Tenants.Migrations do
"select * from pg_catalog.pg_tables where schemaname = 'realtime' and tablename = 'schema_migrations';"

%{extensions: [%{settings: settings} | _]} = tenant
%{num_rows: num_rows} = Postgrex.query!(db_conn, query, [])

{:ok, %{num_rows: num_rows}} =
Database.transaction(db_conn, fn db_conn -> Postgrex.query!(db_conn, query, []) end)

if num_rows < @expected_migration_count do
run_migrations(%__MODULE__{tenant_external_id: tenant.external_id, settings: settings})
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.33.43",
version: "2.33.44",
elixir: "~> 1.16.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 5dafe26

Please sign in to comment.