Skip to content

Keep recently seen balloons tracked outside boundary#2

Draft
MrARM wants to merge 1 commit intomainfrom
codex/fix-balloon-tracking-behavior
Draft

Keep recently seen balloons tracked outside boundary#2
MrARM wants to merge 1 commit intomainfrom
codex/fix-balloon-tracking-behavior

Conversation

@MrARM
Copy link
Copy Markdown
Owner

@MrARM MrARM commented Mar 29, 2026

Motivation

  • Fix behavior where balloons that drift outside the detection area stop being tracked by continuing to process packets for serials that were recently seen.
  • Keep the solution CPU and memory efficient by using an in-memory lookup (not Redis) with a very cheap per-packet check.
  • Ensure entries age out automatically so memory stays bounded.

Description

  • Add tracker.go which implements a lightweight thread-safe serialTracker with wasSeenRecently, markSeen, and removeStale methods and a cleanup goroutine started by startStaleSeenSerialsCleanup that runs hourly.
  • Instantiate the tracker in balloony.go as seenSerials = newSerialTracker() and stamp every incoming packet with seenSerials.markSeen(pkt.Serial, pkt.TimeReceived).
  • Change out-of-bounds filtering to allow processing of packets whose serials were seen recently by checking wasSeen := seenSerials.wasSeenRecently(pkt.Serial) before skipping; first-time out-of-bounds serials are still ignored.
  • Start the hourly cleanup worker at startup with startStaleSeenSerialsCleanup(seenSerials) and keep the lookup in memory only (no Redis changes).

Testing

  • Ran go test ./... which completed successfully (no test files in the module).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant