Skip to content

Commit

Permalink
fix: Kill Janitor conns on process end (#1206)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipecabaco authored Nov 11, 2024
1 parent 70c1976 commit 30592e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/realtime/tenants/janitor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.33.28",
version: "2.33.29",
elixir: "~> 1.16.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 30592e5

Please sign in to comment.