Commit graph

44 commits

Author SHA1 Message Date
dc0e49780b
Fix timer cancellation in PacketConsumer and simplify migration
- Add nil check before canceling timer in PacketConsumer to prevent errors
  when timer reference doesn't exist (fixes test failures)
- Simplify packet counter reset migration by removing unsupported event
  triggers, keeping only manual reset function
- All tests now passing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 08:48:57 -05:00
2629589b7f
Fix packet counter accuracy after TRUNCATE operations
The packet counter uses a PostgreSQL sequence that doesn't get reset
when the packets table is truncated, causing inaccurate counts.

This migration:
- Creates an event trigger that automatically resets the packet counter
  sequence when the packets table is truncated
- Adds a manual reset function reset_packet_counter() that can be called
  if needed
- Improves the get_packet_count() function to properly handle when the
  sequence is at 0

After applying this migration, the counter will automatically reset to 0
whenever TRUNCATE is used on the packets table.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-19 15:25:56 -05:00
234fc2010f
Implement critical performance optimizations and error handling
This commit introduces several major performance improvements and adds
robust error handling for malformed HTTP requests:

Performance Optimizations:
- Add database migration with BRIN indexes for time-series data and partial
  indexes for recent queries, significantly improving query performance
- Create global StreamingPacketsPubSub system for real-time packet distribution
  with geographic bounds filtering using ETS for fast lookups
- Refactor PacketConsumer to use Stream module for memory-efficient processing,
  preventing memory accumulation during batch operations
- Implement dedicated BroadcastTaskSupervisor pool for async broadcast operations,
  preventing GenServer blocking on I/O
- Increase database connection pool from 25 to 45 (production) and 15 to 30 (dev)
  for better concurrency support

Error Handling:
- Add SentryFilter to prevent Bandit.HTTPError from missing Host headers from
  cluttering Sentry (common with bots/scanners)
- Configure custom 400 Bad Request error handling
- Filter out common bot/scanner paths from error reporting

All changes include comprehensive test coverage following TDD practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-18 18:19:49 -05:00
400e444eaa
Fix packet_counters table bloat with sequence-based counter
- Add aggressive autovacuum settings for packet_counters table
- Replace table-based counter with PostgreSQL sequence to eliminate bloat
- Sequences are designed for high-frequency counter operations
- Maintains backward compatibility through get_packet_count() function

The packet_counters table was experiencing severe bloat due to 350K+ updates
on a single row. PostgreSQL sequences avoid this issue entirely.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 13:34:15 -05:00
e97d1d6e33
Fix duplicate indexes and missing socket assigns
- Remove duplicate received_at indexes (packets_received_at_asc_idx and packets_recent_hour_idx)
  that were consuming 423 MB, keeping only packets_received_at_idx
- Fix KeyError by initializing missing :all_packets and :visible_packets in socket assigns
- All tests now pass successfully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 11:01:27 -05:00
c431a45b0b
remove duplicate indexes and fix telemetry metrics 2025-07-15 09:17:30 -05:00
8e507702f7
more performance improvements/cleanup 2025-07-14 16:49:55 -05:00
3730b8c848
performance improvements 2025-07-14 16:35:58 -05:00
389ce8edeb
cleanup worker tweaks 2025-07-14 12:31:47 -05:00
c09f9175f4
add PHG parsing 2025-07-12 10:22:43 -05:00
6a97ba7e45
optimize migrations 2025-07-11 13:06:49 -05:00
952cd40efe
try to fix initial db migration 2025-07-10 18:08:28 -05:00
38920e9f3d
add callsign to users 2025-07-10 16:07:05 -05:00
adc83007e4
restore users table 2025-07-10 15:30:21 -05:00
d45aed256d
fix historical packet loading 2025-07-10 13:15:16 -05:00
48447ab42e
refactor and performance improvements 2025-07-10 10:53:34 -05:00
43b2cb1df0
fix migration errors 2025-07-09 16:27:21 -05:00
514d1b66d5
fix all the main map display issues 2025-07-09 16:20:29 -05:00
711d92ebb6
performance improvements 2025-07-08 10:03:52 -05:00
58d940435e
enable pg_stats 2025-07-07 16:45:48 -05:00
dd9dd7ce1d
improve status page 2025-07-07 12:20:03 -05:00
ad18f641b8
include migration 2025-07-07 11:06:35 -05:00
8c06f1f8fa
more typescript and update weather charts in real time 2025-07-05 12:47:11 -05:00
179fdded66
drop users tables 2025-07-04 16:54:29 -05:00
5e48a7be8a
gitignore and drop existing users table 2025-07-04 16:22:51 -05:00
5bdb40b9f8
indexes 2025-07-04 12:49:35 -05:00
a78fb8a385
live update info page 2025-07-04 11:45:00 -05:00
48b8c7de94
add index for weather 2025-07-03 13:07:34 -05:00
1354b7da07
historical packets working again 2025-06-28 11:34:15 -05:00
f08330b46c
weather fixing 2025-06-25 11:40:04 -05:00
229c8f8305
fix messaging name 2025-06-24 14:29:47 -05:00
ce7c50caa1
refactor to use external parser 2025-06-24 14:22:09 -05:00
a48b2edcb3
add device identifier 2025-06-23 14:19:04 -05:00
ecee5fd677
major refactor and fixes with streaming 2025-06-20 14:09:43 -05:00
c151c34857
pubsub 2025-06-19 11:57:28 -05:00
4c0433d32e
increase packet length 2025-06-17 11:32:52 -05:00
020d1e58cf
display updates 2025-06-17 11:07:26 -05:00
506e5550b4
postgis 2025-06-16 09:58:17 -05:00
2f20a19c6a
run migrations on start 2025-06-15 21:54:06 -05:00
f9fa765e32
add oban tables 2025-06-15 21:32:37 -05:00
7a57739ed7
tweaks 2025-06-15 21:14:10 -05:00
246cb43244 initial packets working 2023-01-31 13:08:17 -06:00
7b874d9afa add auth 2023-01-29 13:29:25 -06:00
d40567dfeb initial 2023-01-26 13:20:23 -06:00