Skip to content

Naomizheng/fix stale npm cache bug#530

Merged
danfiedler-msft merged 7 commits intomicrosoft:mainfrom
naomizhengmsft:naomizheng/fixStaleNPMCacheBug
Apr 8, 2026
Merged

Naomizheng/fix stale npm cache bug#530
danfiedler-msft merged 7 commits intomicrosoft:mainfrom
naomizhengmsft:naomizheng/fixStaleNPMCacheBug

Conversation

@naomizhengmsft
Copy link
Copy Markdown
Member

@naomizhengmsft naomizhengmsft commented Mar 25, 2026

NPM needs to fetch package entire metadata and stores it in the cache. Previously if the package we are trying to fetch exist in the cache, we would then assume it would have the version we need but the data in the cache could be stale especially if the new package was published within 30 minutes of the initial cache store so we should try to refetch the data or else we would return back null.

Comment thread src/Shared/PackageManagers/NPMProjectManager.cs
@naomizhengmsft
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@jpinz
Copy link
Copy Markdown
Member

jpinz commented Apr 2, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 530 in repo microsoft/OSSGadget

@morended
Copy link
Copy Markdown
Contributor

morended commented Apr 8, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@danfiedler-msft
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@danfiedler-msft danfiedler-msft merged commit a41b2da into microsoft:main Apr 8, 2026
1 check passed
Comment on lines +614 to +615
DataCache.Remove($"{cacheUrl}/json");
jsonDoc = await GetJsonCache(client, cacheUrl, useCache: false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@naomizhengmsft I'm a bit late to this PR, but this line states useCache: false. Isn't that redundant with DataCache.Remove($"{cacheUrl}/json"); above? Would we be fine if this second call to GetJsonCache updated the cache again with a fresh value (since we just explicitly evicted any prior value there)?

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.

6 participants