Skip to content

Integrate record cache into event loop#270

Open
backkem wants to merge 2 commits into
mainfrom
cache-integration
Open

Integrate record cache into event loop#270
backkem wants to merge 2 commits into
mainfrom
cache-integration

Conversation

@backkem
Copy link
Copy Markdown
Member

@backkem backkem commented Mar 4, 2026

Summary

  • Wire the cache from Add DNS record cache with TTL management #266 into the mDNS event loop: insert all answer/additional records on receive
  • Periodic sweep of expired entries (10s default)
  • Proactive cache refresh at 80/85/90/95% of TTL per RFC 6762 §5.2
  • WithCacheRefresh(bool) and WithRefreshInterval(time.Duration) server options
  • Refresh enabled by default in NewServer, disabled in legacy Server() to preserve existing behavior

Builds on #266 (record cache with TTL management). This PR supersedes #266 — the commits from #266 are included here. Both can be merged separately (cache first, then integration) or together via this PR.

Wire the cache from #266 into the mDNS event loop:
- Insert all answer/additional records on receive
- Periodic sweep of expired entries (10s interval)
- Proactive cache refresh at 80/85/90/95% TTL (RFC 6762 §5.2)
- WithCacheRefresh(bool) / WithRefreshInterval(dur) options
- Refresh enabled by default in NewServer, disabled in legacy Server()
@backkem backkem requested a review from JoTurk March 4, 2026 19:26
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 89.07285% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.03%. Comparing base (420dc04) to head (99408cc).

Files with missing lines Patch % Lines
client.go 67.16% 20 Missing and 2 partials ⚠️
config.go 50.00% 5 Missing ⚠️
conn.go 90.90% 3 Missing and 1 partial ⚠️
cache.go 98.83% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #270      +/-   ##
==========================================
+ Coverage   80.61%   82.03%   +1.42%     
==========================================
  Files           7        8       +1     
  Lines        1599     1893     +294     
==========================================
+ Hits         1289     1553     +264     
- Misses        201      228      +27     
- Partials      109      112       +3     
Flag Coverage Δ
go 82.03% <89.07%> (+1.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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