Skip to content

Commit 07de665

Browse files
authored
fix: use GenRpc for Realtime.Latency pings (#1560)
1 parent 16bd44d commit 07de665

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ PORT ?= 4000
99
# Common commands
1010

1111
dev: ## Start a dev server
12-
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=fra 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
12+
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
1313

1414
dev.orange: ## Start another dev server (orange) on port 4001
15-
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 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 [email protected] --cookie cookie -S mix phx.server
15+
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 [email protected] --cookie cookie -S mix phx.server
1616

1717
seed: ## Seed the database
1818
DB_ENC_KEY="1234567890123456" FLY_ALLOC_ID=123e4567-e89b-12d3-a456-426614174000 mix run priv/repo/dev_seeds.exs

lib/realtime/monitoring/latency.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule Realtime.Latency do
77
use Realtime.Logs
88

99
alias Realtime.Nodes
10-
alias Realtime.Rpc
10+
alias Realtime.GenRpc
1111

1212
defmodule Payload do
1313
@moduledoc false
@@ -33,7 +33,7 @@ defmodule Realtime.Latency do
3333
}
3434
end
3535

36-
@every 5_000
36+
@every 15_000
3737
def start_link(args) do
3838
GenServer.start_link(__MODULE__, args, name: __MODULE__)
3939
end
@@ -76,7 +76,7 @@ defmodule Realtime.Latency do
7676
Task.Supervisor.async(Realtime.TaskSupervisor, fn ->
7777
{latency, response} =
7878
:timer.tc(fn ->
79-
Rpc.call(n, __MODULE__, :pong, [pong_timeout], timeout: timer_timeout)
79+
GenRpc.call(n, __MODULE__, :pong, [pong_timeout], timeout: timer_timeout)
8080
end)
8181

8282
latency_ms = latency / 1_000
@@ -85,7 +85,7 @@ defmodule Realtime.Latency do
8585
from_node = Nodes.short_node_id_from_name(Node.self())
8686

8787
case response do
88-
{:badrpc, reason} ->
88+
{:error, :rpc_error, reason} ->
8989
log_error(
9090
"RealtimeNodeDisconnected",
9191
"Unable to connect to #{short_name} from #{region}: #{reason}"

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
44
def project do
55
[
66
app: :realtime,
7-
version: "2.52.0",
7+
version: "2.52.1",
88
elixir: "~> 1.17.3",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
start_permanent: Mix.env() == :prod,

0 commit comments

Comments
 (0)