Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/realtime/tenants/connect.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion lib/realtime/tenants/replication_connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions test/realtime/tenants/connect_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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)
Expand Down
Loading