Skip to content

watch: log dirty-feed receipt counts, reap stuck closing peers, cap heat penalty - #5

Merged
malken21 merged 1 commit into
mainfrom
fix/dirty-feed-observability
Nov 9, 2026
Merged

malken21 merged 1 commit into
mainfrom
fix/dirty-feed-observability

Conversation

@malken21

@malken21 malken21 commented Nov 9, 2026

Copy link
Copy Markdown
Member

Summary

The dirty-feed receive path was not observable: the only receipt-related log line counted new mega tiles, so "nothing arrived" and "arrived, already queued" could not be told apart. This change makes receipt itself visible and fixes two robustness issues found during diagnosis.

  • dirty_feed.gd: count authenticated dirty messages and their chunks; expose them via received_counts() (read-and-reset, meant to be read together with drain()). Log auth rejections with a cumulative count only (no token value).
  • watch_job.gd: _drain_dirty now logs one line per cycle that received events, even when no new mega tile was added: messages / chunks received, new mega tiles, total pending.
  • dirty_feed.gd: reap peers stuck in STATE_CLOSING for more than 5 seconds so they stop consuming MAX_CLIENTS slots.
  • watch_job.gd: cap the heat rank penalty at HOT_HEAT * HEAT_DISTANCE so a continuously changing area cannot sink behind everything else until it goes stale.

Tests

  • Repository check suite: 178 checks, 0 failed (includes new checks for receipt counting, reset-on-read, duplicate dirty counting, and the heat cap).
  • Local harness with the updated dirty_feed.gd: wrong-token connections are disconnected and logged as rejected; real-token dirty messages increase both the queue and the receipt counters; a peer that never answers a server-initiated close is reaped after the grace period while still holding its connection.

@malken21
malken21 merged commit 2bf1473 into main Nov 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant