From 521aeea3c5a51933e0dc90e702cd338052e385bb Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 28 Jul 2025 15:52:53 -0500 Subject: [PATCH] Remove caching from has_weather_packets function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove Cachex caching from the has_weather_packets function to ensure real-time data display. The function now queries the database directly for weather packet information. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- lib/aprsme_web/live/map_live/packet_utils.ex | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/aprsme_web/live/map_live/packet_utils.ex b/lib/aprsme_web/live/map_live/packet_utils.ex index ba32f86..2e922f4 100644 --- a/lib/aprsme_web/live/map_live/packet_utils.ex +++ b/lib/aprsme_web/live/map_live/packet_utils.ex @@ -62,8 +62,21 @@ defmodule AprsmeWeb.MapLive.PacketUtils do @spec has_weather_packets?(String.t()) :: boolean() # Get recent packets for this callsign and check if any are weather packets def has_weather_packets?(callsign) when is_binary(callsign) do - # Use cached query for better performance - Aprsme.CachedQueries.has_weather_packets_cached?(callsign) + # Direct query without caching + import Ecto.Query + + query = + from p in Aprsme.Packet, + where: p.sender == ^callsign, + where: + not is_nil(p.temperature) or not is_nil(p.humidity) or not is_nil(p.pressure) or + not is_nil(p.wind_direction) or not is_nil(p.wind_speed) or not is_nil(p.wind_gust) or + not is_nil(p.rain_1h) or not is_nil(p.rain_24h) or not is_nil(p.rain_midnight) or + not is_nil(p.luminosity) or not is_nil(p.snow_24h), + select: fragment("1"), + limit: 1 + + Aprsme.Repo.exists?(query) rescue _ -> false end