Skip to content

Commit

Permalink
fix: partition Connect DynamicSupervisors correctly (#1183)
Browse files Browse the repository at this point in the history
* fix: partition Connect DynamicSupervisors correctly

* fix: fix other PartitionSupavisor names
  • Loading branch information
chasers authored Oct 30, 2024
1 parent c069edb commit 8d67cd8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/extensions/postgres_cdc_rls/cdc_rls.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ defmodule Extensions.PostgresCdcRls do
Logger.debug("Starting #{__MODULE__} extension with args: #{inspect(args, pretty: true)}")

DynamicSupervisor.start_child(
{:via, PartitionSupervisor, {Rls.DynamicSupervisor, self()}},
{:via, PartitionSupervisor, {Rls.DynamicSupervisor, tenant}},
%{
id: tenant,
start: {Rls.WorkerSupervisor, :start_link, [args]},
Expand Down
2 changes: 1 addition & 1 deletion lib/extensions/postgres_cdc_stream/cdc_stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ defmodule Extensions.PostgresCdcStream do
Logger.debug("Starting #{__MODULE__} extension with args: #{inspect(args, pretty: true)}")

DynamicSupervisor.start_child(
{:via, PartitionSupervisor, {Stream.DynamicSupervisor, self()}},
{:via, PartitionSupervisor, {Stream.DynamicSupervisor, tenant}},
%{
id: tenant,
start: {Stream.WorkerSupervisor, :start_link, [args]},
Expand Down
4 changes: 3 additions & 1 deletion lib/realtime/tenants/connect.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ defmodule Realtime.Tenants.Connect do
"""
@spec connect(binary(), keyword()) :: {:ok, DBConnection.t()} | {:error, term()}
def connect(tenant_id, opts \\ []) do
supervisor = {:via, PartitionSupervisor, {Realtime.Tenants.Connect.DynamicSupervisor, self()}}
supervisor =
{:via, PartitionSupervisor, {Realtime.Tenants.Connect.DynamicSupervisor, tenant_id}}

spec = {__MODULE__, [tenant_id: tenant_id] ++ opts}

case DynamicSupervisor.start_child(supervisor, spec) do
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.16",
version: "2.33.17",
elixir: "~> 1.16.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 8d67cd8

Please sign in to comment.