fix: unsubscribe from pubsub topics on LiveView terminate; catch-all handle_info in ConnectionManager

This commit is contained in:
Graham McIntire 2026-04-17 13:24:57 -05:00
parent 177b88c3f3
commit 0b178d45ba
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 7 additions and 0 deletions

View file

@ -56,6 +56,9 @@ defmodule Aprsme.Cluster.ConnectionManager do
end
end
@impl true
def handle_info(_msg, state), do: {:noreply, state}
@impl true
def terminate(_reason, _state) do
Phoenix.PubSub.unsubscribe(Aprsme.PubSub, "cluster:leadership")

View file

@ -1878,6 +1878,10 @@ defmodule AprsmeWeb.MapLive.Index do
# Unsubscribe from StreamingPacketsPubSub
Aprsme.StreamingPacketsPubSub.unsubscribe(self())
# Unsubscribe from Endpoint/PubSub topics subscribed in mount
Endpoint.unsubscribe("aprs_messages")
Phoenix.PubSub.unsubscribe(Aprsme.PubSub, "postgres:aprsme_packets")
if socket.assigns.buffer_timer, do: Process.cancel_timer(socket.assigns.buffer_timer)
# Clean up any pending bounds update timer
if socket.assigns[:bounds_update_timer] do