A station that last transmitted yesterday evening disappears from its info page while its packets page still lists it #52
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Latest-packet lookups cut off at a rolling instant (now minus retention days), but partitions are dropped on a day boundary, so with one day retention the previous day's partition is still present for most of today while every lookup refuses rows older than the cutoff. A station whose last packet was between midnight and the cutoff time yesterday is still listed on
/packets/:callsign, its info page renders the not-found empty state, clicking it on the map does not center anything, and the callsign API answers not found.Evidence
At
2f150f66:lib/aprsme/packets/prepared_queries.ex:26and:44bound both latest-packet queries withwhere: p.received_at >= ^cutoff.lib/aprsme/packets/prepared_queries.ex:70computes that cutoff asDateTime.shift(DateTime.utc_now(), day: -retention_days), a rolling instant.lib/aprsme/packets/prepared_queries.ex:20documents the assumption that cleanup already removed those rows, which the partition boundary contradicts.lib/aprsme/partition_manager.ex:90and:98drop a partition only once its upper bound passes the same rolling cutoff, so the day's first hours remain readable in the table.lib/aprsme/packets.ex:496lists a callsign's packets with no received_at bound, which is why the packets page and the info page disagree.lib/aprsme_web/live/info_live/show.ex:246renders the same empty state for nil as for an unknown callsign.Expected
The query bound matches what retention actually keeps: if the oldest retained partition starts at day D 00:00, a packet received at D 01:00 is found. Floor the cutoff to the start of the oldest retained day, or align the partition drop to the same instant.
How to verify
Insert a packet at yesterday 01:00 with retention 1, run the partition drop (nothing qualifies), then call
Aprsme.Packets.get_latest_packet_for_callsign/1andget_packets_for_callsign/2: the second returns the row and the first returns nil.Acceptance criteria
GET /api/v1/callsign/:callsignagree with/packets/:callsign.Effort: S
Lens: data