Skip to content

perf(registries): share publish-date lookups per poll cycle - #1655

Merged
scttbnsn merged 2 commits into
dev/v1.9from
perf/v1.9-registry-hass
Nov 20, 2026
Merged

scttbnsn merged 2 commits into
dev/v1.9from
perf/v1.9-registry-hass

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Performance fixes from the whole-app review, registry and MQTT side.

  • GHCR, LSCR and Docker Hub publish-date lookups are now shared per registry, image and tag for the length of a poll cycle, including lookups still in flight. Containers that share an image hit the registry once per cycle instead of once each. Failed lookups aren't cached, and the cache clears at the start and end of every cycle.
  • GHCR version paging now goes through the api.github.com rate limiter.
  • With agent topic segments on, the Home Assistant MQTT refresh counts watcher containers from the raw store list instead of cloning and redacting every container on each refresh. The counts don't change.

Tests cover the cache hit, in-flight sharing, failed-lookup cleanup and the MQTT refresh no longer calling getContainers.

✨ Added

  • BaseRegistry: poll-cycle publish-date cache. startDigestCachePollCycle and endDigestCachePollCycle clear it. memoizePublishedAt shares cached and in-flight lookups by registry URL, image, and tag. Failed lookups are removed.
  • RegistryLookupOptions with usePollCycleCache (set to false to bypass the cache).
  • Ghcr: waits for a URL-specific token bucket before each versions-page request.
  • Hub: private fetchImagePublishedAt method.

🔧 Changed

  • Ghcr.getImagePublishedAt and Hub.getImagePublishedAt: new optional options?: RegistryLookupOptions parameter.
  • Hass.ts: with agent topic segments enabled, watcher counts read from containerStore.getContainersRaw. Disabled path is unchanged.

⚠️ Breaking

  • None stated.

🐛 Fixed

  • Not applicable. No bug fix is stated.

🗑️ Removed

  • None.

🔒 Security

  • None.

Concerns:

  • Verify all getImagePublishedAt callers and implementations accept the new options parameter. Check for other registry providers that still use the old signature.
  • Verify getContainersRaw results are not mutated or emitted in MQTT payloads. The redacted clone path is bypassed.
  • Verify cache removal on failure does not delete a newer cycle's entry when an older in-flight lookup fails late. The test covers this; confirm the code path.
  • Ghcr and Hub both wrap memoizePublishedAt. Check for duplicated memoize/key logic that should stay in BaseRegistry.
  • Confirm the GHCR versions-page limiter uses the shared api.github.com bucket, not a per-request bucket.
  • CI and test results: not available. Only the author's claims are known.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds poll-cycle caching for publish-date lookups in GHCR and Docker Hub. GHCR also acquires a rate-limit token before each versions-page request. For segmented MQTT watcher counts, Hass now reads raw containers before filtering by agent and calculating counts.

Change: Refactor

Merge Risk: Minimal · up to d6fee

This change shares registry publish-date lookups within a poll cycle, adds rate limiting to GHCR version paging, and avoids cloning containers for MQTT watcher counts. No actionable merge risk was identified.

Pre-merge checks: Passed 2

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between edb2f3d and d6fee98.

Files ignored due to path filters: 1

  • CHANGELOG.md is excluded by !CHANGELOG.md
Files selected for processing: 7

  • app/registries/BaseRegistry.ts
  • app/registries/providers/ghcr/Ghcr.test.ts
  • app/registries/providers/ghcr/Ghcr.ts
  • app/registries/providers/hub/Hub.test.ts
  • app/registries/providers/hub/Hub.ts
  • app/triggers/providers/mqtt/Hass.test.ts
  • app/triggers/providers/mqtt/Hass.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttbnsn
scttbnsn merged commit 061b7fb into dev/v1.9 Nov 20, 2026
33 checks passed
@scttbnsn
scttbnsn deleted the perf/v1.9-registry-hass branch November 20, 2026 04:26
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