Skip to content
Merged
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
1 change: 0 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ config :logger, :console,
config :phoenix, :json_library, Jason

config :logflare_logger_backend,
url: "https://api.logflare.app",
flush_interval: 1_000,
max_batch_size: 50,
metadata: :all
Expand Down
3 changes: 3 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Config

config :logflare_logger_backend,
url: System.get_env("LOGFLARE_LOGGER_BACKEND_URL", "https://api.logflare.app")

if config_env() == :prod do
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
Expand Down
2 changes: 0 additions & 2 deletions lib/realtime/monitoring/prom_ex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ defmodule Realtime.PromEx do

import Realtime.Helpers, only: [short_node_id: 0]

import Realtime.Helpers, only: [short_node_id: 0]

@moduledoc """
Be sure to add the following to finish setting up PromEx:

Expand Down
2 changes: 1 addition & 1 deletion lib/realtime/monitoring/prom_ex/plugins/tenant.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ defmodule Realtime.PromEx.Plugins.Tenant do
measurement: :duration,
description: "Duration of the logical replication slot polling query for Realtime RLS.",
tags: [:tenant],
unit: {:native, :millisecond},
unit: {:microsecond, :millisecond},
reporter_options: [
buckets: [125, 250, 500, 1_000, 2_000, 4_000, 8_000, 16_000, 32_000, 64_000]
]
Expand Down
35 changes: 7 additions & 28 deletions lib/realtime_web/channels/realtime_channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ defmodule RealtimeWeb.RealtimeChannel do
{UUID.string_to_binary!(id), :erlang.phash2(params)}
end

IO.inspect(topic, label: "CHANNEL TOPIC")

metadata = [
metadata:
{:subscriber_fastlane, transport_pid, serializer, ids, topic, tenant, is_new_api}
Expand Down Expand Up @@ -237,22 +235,7 @@ defmodule RealtimeWeb.RealtimeChannel do
def handle_info(:sync_presence, %{assigns: %{tenant_topic: topic}} = socket) do
socket = count(socket)

presence_list =
socket
|> presence_list_shard_bypass()
|> case do
{:ok, [_ | _]} ->
Presence.list(topic)

{:ok, []} ->
%{}

{:error, message} ->
Logger.error("Unable to fetch Presence list for topic #{topic}: #{message}")
Presence.list(topic)
end

push(socket, "presence_state", presence_list)
push(socket, "presence_state", presence_dirty_list(topic))

{:noreply, socket}
end
Expand Down Expand Up @@ -653,17 +636,13 @@ defmodule RealtimeWeb.RealtimeChannel do
})
end

defp presence_list_shard_bypass(%{assigns: %{tenant_topic: topic}} = _socket) do
try do
[{:pool_size, size}] = :ets.lookup(Presence, :pool_size)
def presence_dirty_list(topic) do
[{:pool_size, size}] = :ets.lookup(Presence, :pool_size)

{:ok,
Presence
|> Shard.name_for_topic(topic, size)
|> Shard.dirty_list(topic)}
rescue
e -> {:error, Exception.message(e)}
end
Presence
|> Shard.name_for_topic(topic, size)
|> Shard.dirty_list(topic)
|> Phoenix.Presence.group()
end

defp start_db_rate_counter(tenant) 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.9.0",
version: "2.9.4",
elixir: "~> 1.14.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down
Loading