Skip to content

Disable negative caching for local.hass.io - #202

Merged
agners merged 2 commits into
masterfrom
cache-disable-denial
Aug 5, 2026
Merged

Disable negative caching for local.hass.io#202
agners merged 2 commits into
masterfrom
cache-disable-denial

Conversation

@agners

@agners agners commented Aug 5, 2026

Copy link
Copy Markdown
Member

Proposed change

Add disable denial local.hass.io to the cache plugin on the main server block.

When a name under local.hass.io is queried before Supervisor's freshly written hosts entry has been picked up (e.g. right after an add-on started), the resulting NXDOMAIN is negative-cached for ~5s — so resolution keeps failing even after the hosts file reload has made the entry visible.

These names are answered from the local hosts file (or the template fallback), so negative caching provides no upstream offload; disabling it only removes the failure amplification. Positive answers are still cached.

Companion PR: #201 (faster hosts file reload), which shrinks the window in which the stale NXDOMAIN can be produced in the first place.

Type of change

  • Bugfix (non-breaking change which fixes an issue)

🤖 Generated with Claude Code

When a name under local.hass.io is queried before Supervisor's hosts
file entry is picked up (e.g. right after an add-on started), the
resulting NXDOMAIN is negative-cached for ~5s, prolonging resolution
failures even after the hosts entry became visible.

Disable caching of denial responses for local.hass.io. Positive answers
are still cached, and entries for these names live in the local hosts
file anyway, so negative caching provides no benefit here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the CoreDNS configuration used by the DNS plugin to prevent negative caching (NXDOMAIN/NODATA) for names under local.hass.io, reducing “stale NXDOMAIN” amplification during the short window before newly-written /config/hosts entries are reloaded.

Changes:

  • Replace the bare cache directive with a cache { ... } block.
  • Disable denial (negative) caching specifically for local.hass.io while keeping positive caching enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The static /etc/corefile is used when tempio fails to render the
template; keep its cache block in sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@agners
agners requested review from sairon and a lite review from Copilot August 5, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@agners
agners merged commit b2e083f into master Aug 5, 2026
9 checks passed
@agners
agners deleted the cache-disable-denial branch August 5, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants