From 30592e5b7fd8e3b1efe09bd8241153ce1ee6fd86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Mon, 11 Nov 2024 16:59:15 +0000 Subject: [PATCH] fix: Kill Janitor conns on process end (#1206) --- lib/realtime/tenants/janitor.ex | 3 ++- mix.exs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/realtime/tenants/janitor.ex b/lib/realtime/tenants/janitor.ex index 0e1a6993a..ea7a7726d 100644 --- a/lib/realtime/tenants/janitor.ex +++ b/lib/realtime/tenants/janitor.ex @@ -114,12 +114,13 @@ defmodule Realtime.Tenants.Janitor do defp run_cleanup_on_tenant(tenant_external_id) do Logger.metadata(project: tenant_external_id, external_id: tenant_external_id) - Logger.info("Janitor cleaned realtime.messages") + Logger.info("Janitor starting realtime.messages cleanup") with %Tenant{} = tenant <- Tenants.Cache.get_tenant_by_external_id(tenant_external_id), {:ok, conn} <- Database.connect(tenant, "realtime_janitor", 1), :ok <- Messages.delete_old_messages(conn) do Logger.info("Janitor finished") + GenServer.stop(conn) Tenants.untrack_active_tenant(tenant_external_id) :ok end diff --git a/mix.exs b/mix.exs index 2b11f433b..2fbcc2896 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do def project do [ app: :realtime, - version: "2.33.28", + version: "2.33.29", elixir: "~> 1.16.0", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,