diff --git a/Makefile b/Makefile index 1259a1335..f886160c0 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,10 @@ PORT ?= 4000 # Common commands dev: ## Start a dev server - ELIXIR_ERL_OPTIONS="+hmax 1000000000" SLOT_NAME_SUFFIX=some_sha PORT=$(PORT) MIX_ENV=dev SECURE_CHANNELS=true API_JWT_SECRET=dev METRICS_JWT_SECRET=dev REGION=us-east-1 DB_ENC_KEY="1234567890123456" CLUSTER_STRATEGIES=$(CLUSTER_STRATEGIES) ERL_AFLAGS="-kernel shell_history enabled" GEN_RPC_TCP_SERVER_PORT=5369 GEN_RPC_TCP_CLIENT_PORT=5469 iex --name $(NODE_NAME)@127.0.0.1 --cookie cookie -S mix phx.server + ELIXIR_ERL_OPTIONS="+hmax 1000000000" SLOT_NAME_SUFFIX=some_sha PORT=$(PORT) MIX_ENV=dev SECURE_CHANNELS=true API_JWT_SECRET=dev METRICS_JWT_SECRET=dev REGION=us-east-1 DB_ENC_KEY="1234567890123456" CLUSTER_STRATEGIES=$(CLUSTER_STRATEGIES) ERL_AFLAGS="-kernel shell_history enabled" GEN_RPC_TCP_SERVER_PORT=5369 GEN_RPC_TCP_CLIENT_PORT=5469 DASHBOARD_USER=realtime DASHBOARD_PASSWORD=realtime iex --name $(NODE_NAME)@127.0.0.1 --cookie cookie -S mix phx.server dev.orange: ## Start another dev server (orange) on port 4001 - ELIXIR_ERL_OPTIONS="+hmax 1000000000" SLOT_NAME_SUFFIX=some_sha PORT=4001 MIX_ENV=dev SECURE_CHANNELS=true API_JWT_SECRET=dev METRICS_JWT_SECRET=dev REGION=eu-west-1 DB_ENC_KEY="1234567890123456" CLUSTER_STRATEGIES=$(CLUSTER_STRATEGIES) ERL_AFLAGS="-kernel shell_history enabled" GEN_RPC_TCP_SERVER_PORT=5469 GEN_RPC_TCP_CLIENT_PORT=5369 iex --name orange@127.0.0.1 --cookie cookie -S mix phx.server + ELIXIR_ERL_OPTIONS="+hmax 1000000000" SLOT_NAME_SUFFIX=some_sha PORT=4001 MIX_ENV=dev SECURE_CHANNELS=true API_JWT_SECRET=dev METRICS_JWT_SECRET=dev REGION=eu-west-1 DB_ENC_KEY="1234567890123456" CLUSTER_STRATEGIES=$(CLUSTER_STRATEGIES) ERL_AFLAGS="-kernel shell_history enabled" GEN_RPC_TCP_SERVER_PORT=5469 GEN_RPC_TCP_CLIENT_PORT=5369 DASHBOARD_USER=realtime DASHBOARD_PASSWORD=realtime iex --name orange@127.0.0.1 --cookie cookie -S mix phx.server seed: ## Seed the database DB_ENC_KEY="1234567890123456" FLY_ALLOC_ID=123e4567-e89b-12d3-a456-426614174000 mix run priv/repo/dev_seeds.exs diff --git a/lib/realtime/tenants/connect.ex b/lib/realtime/tenants/connect.ex index 53ef78a40..d2a8da7a8 100644 --- a/lib/realtime/tenants/connect.ex +++ b/lib/realtime/tenants/connect.ex @@ -249,7 +249,7 @@ defmodule Realtime.Tenants.Connect do tenant_id: tenant_id, check_connected_user_interval: check_connected_user_interval, check_connect_region_interval: check_connect_region_interval, - backoff: Backoff.new(backoff_min: :timer.seconds(1), backoff_max: :timer.seconds(15), backoff_type: :rand_exp) + backoff: Backoff.new(backoff_min: :timer.seconds(5), backoff_max: :timer.minutes(5), backoff_type: :rand_exp) } opts = Keyword.put(opts, :name, {:via, :syn, name}) diff --git a/lib/realtime/tenants/replication_connection.ex b/lib/realtime/tenants/replication_connection.ex index d5c04b848..9dc4236d0 100644 --- a/lib/realtime/tenants/replication_connection.ex +++ b/lib/realtime/tenants/replication_connection.ex @@ -11,7 +11,7 @@ defmodule Realtime.Tenants.ReplicationConnection do * `publication_name` - The name of the publication to create. If not provided, it will use the schema and table name. * `replication_slot_name` - The name of the replication slot to create. If not provided, it will use the schema and table name. * `output_plugin` - The output plugin to use. Default is `pgoutput`. - * `proto_version` - The protocol version to use. Default is `1`. + * `proto_version` - The protocol version to use. Default is `2`. * `handler_module` - The module that will handle the data received from the replication stream. * `metadata` - The metadata to pass to the handler module. diff --git a/test/realtime/tenants/connect_test.exs b/test/realtime/tenants/connect_test.exs index 8fd9bff1c..ce1f3d60a 100644 --- a/test/realtime/tenants/connect_test.exs +++ b/test/realtime/tenants/connect_test.exs @@ -694,8 +694,8 @@ defmodule Realtime.Tenants.ConnectTest do assert {:ok, _db_conn} = Connect.lookup_or_start_connection(tenant.external_id) pid = Connect.whereis(tenant.external_id) state = :sys.get_state(pid) - assert state.backoff.min == :timer.seconds(1) - assert state.backoff.max == :timer.seconds(15) + assert state.backoff.min == :timer.seconds(5) + assert state.backoff.max == :timer.minutes(5) assert state.backoff.type == :rand_exp end end @@ -847,7 +847,7 @@ defmodule Realtime.Tenants.ConnectTest do Realtime.Api.update_tenant_by_external_id(tenant.external_id, %{extensions: extensions}) end - defp assert_pid(call, attempts \\ 10) + defp assert_pid(call, attempts \\ 30) defp assert_pid(_call, 0) do raise "Timeout waiting for pid" @@ -864,7 +864,7 @@ defmodule Realtime.Tenants.ConnectTest do end end - defp assert_replication_status(tenant_id, attempts \\ 20) + defp assert_replication_status(tenant_id, attempts \\ 30) defp assert_replication_status(tenant_id, 0) do Connect.replication_status(tenant_id)