Skip to content

Commit

Permalink
fix: Reduce janitor scope to only local tenants (#1303)
Browse files Browse the repository at this point in the history
Reduce janitor scope to only local tenants
  • Loading branch information
filipecabaco authored Feb 20, 2025
1 parent 74bbfca commit 1c780b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/realtime/tenants/janitor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ defmodule Realtime.Tenants.Janitor do
Logger.info("Janitor started")
%{chunks: chunks, tasks: tasks} = state
all_tenants = :ets.select(@table_name, [{{:"$1"}, [], [:"$1"]}])
connected_tenants = :ets.select(@syn_table, [{{:"$1", :_, :_, :_, :_, :_}, [], [:"$1"]}])

connected_tenants =
:ets.select(@syn_table, [{{:"$1", :_, :_, :_, :_, :"$2"}, [{:==, :"$2", {:const, Node.self()}}], [:"$1"]}])

new_tasks =
MapSet.new(all_tenants ++ connected_tenants)
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.34.25",
version: "2.34.26",
elixir: "~> 1.17.3",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 1c780b5

Please sign in to comment.