From 1c780b5e53582728d721524f37349ac66e456d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Thu, 20 Feb 2025 11:13:06 +0000 Subject: [PATCH] fix: Reduce janitor scope to only local tenants (#1303) Reduce janitor scope to only local tenants --- lib/realtime/tenants/janitor.ex | 4 +++- mix.exs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/realtime/tenants/janitor.ex b/lib/realtime/tenants/janitor.ex index e89e9f134..1a41897f7 100644 --- a/lib/realtime/tenants/janitor.ex +++ b/lib/realtime/tenants/janitor.ex @@ -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) diff --git a/mix.exs b/mix.exs index 9a83d6bbf..a9ddaed99 100644 --- a/mix.exs +++ b/mix.exs @@ -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,