[Registry] Cache shared manifest fetches during generation#952
[Registry] Cache shared manifest fetches during generation#952hssuryawanshib23-afk wants to merge 6 commits intomeshery:masterfrom
Conversation
Signed-off-by: Harsh Sunil Suryawanshi <hssuryawanshi_b23@el.vjti.ac.in>
There was a problem hiding this comment.
Code Review
This pull request introduces a packageFetcher utility to optimize package retrieval by implementing caching and request deduplication using singleflight. It refactors the model generation logic to use this fetcher and adds comprehensive unit tests to verify caching behavior and concurrent request handling. A review comment identifies a redundant cache check within the singleflight.Do block that can be removed to simplify the implementation.
Signed-off-by: Harsh Sunil Suryawanshi <hssuryawanshi_b23@el.vjti.ac.in>
Code reviewThe caching approach using Found 1 issue:
The cache key is built from only Lines 54 to 56 in 36ab6bb However,
The result: when multiple models share the same Fix: include |
Signed-off-by: Harsh Sunil Suryawanshi <hssuryawanshi_b23@el.vjti.ac.in>
|
Thanks, @leecalcote. Updated this to address the I split the behavior by backend:
So this keeps the intended optimization for shared GitHub manifests like ASO, while avoiding I also updated the tests to cover both behaviors and re-verified locally with:
|
|
Thanks! |
Summary
Cache package fetches during registry generation when multiple models share the same registrant and source URL.
Changes
GetPackage()for every modelWhy
ASO model generation currently fetches the same shared manifest once per model even though all models point to the same source URL. This change deduplicates those fetches without changing generated output.
Verification
go test ./registry/... -count=1Related