perf(registry): memoize component-info discoverability probe per baseUrl - #1566
Open
ricardo-devis-agullo wants to merge 2 commits into
Open
perf(registry): memoize component-info discoverability probe per baseUrl#1566ricardo-devis-agullo wants to merge 2 commits into
ricardo-devis-agullo wants to merge 2 commits into
Conversation
component-info HTML route self-probed the registry over HTTP (isUrlDiscoverable GET to own baseUrl) on every ~info request, even though the result only changes when deployment config changes. Cache the probe promise per baseUrl for process lifetime with in-flight dedup; add clearDiscoverabilityCache() escape hatch for tests plus OC_DISCOVERABILITY_NO_CACHE=1/true to force re-probing. Fallback to //host+prefix on not-discoverable is unchanged.
Unbounded module-level Map keyed by baseUrl could grow forever when a host-based baseUrlFunc yields distinct baseUrls per Host (perf item 7). Use the registry's BoundedCache (LRU, max 100 entries) keyed by baseUrl instead. Semantics unchanged: per-baseUrl memoization, in-flight promise dedup, clearDiscoverabilityCache(url?)/clear-all, OC_DISCOVERABILITY_NO_CACHE bypass, rejection eviction adapted to the BoundedCache API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: packages/oc/src/registry/routes/component-info.ts:74 called isUrlDiscoverable(href) (undici GET to the registry's own baseUrl) on EVERY HTML info-page request, adding a full HTTP round trip to each ~info view even though the result only changes when deployment config changes.
Fix:
//host+prefixon not-discoverable preserved.Invalidation / escape hatch:
Verify: