-
Notifications
You must be signed in to change notification settings - Fork 77
Fix eng/common cashing #4829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix eng/common cashing #4829
Conversation
There was a problem hiding this comment.
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 addresses caching improvements by updating methods to include an additional repository flag (repoIsVmr), ensuring that caching keys are correctly differentiated for multiple repositories.
- Updated method signatures and calls to include the repoIsVmr parameter.
- Adjusted caching key composition in GitHubClient.
- Introduced an extraneous variable which may need removal.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/Microsoft.DotNet.Darc/DarcLib/RemoteRepoBase.cs | Unused variable introduced in CommitFilesAsync |
src/Microsoft.DotNet.Darc/DarcLib/Remote.cs | Updated GetFilesAtCommitAsync signature to pass repoIsVmr |
src/Microsoft.DotNet.Darc/DarcLib/IRemoteGitRepo.cs | Updated interface signature for GetFilesAtCommitAsync |
src/Microsoft.DotNet.Darc/DarcLib/GitHubClient.cs | Updated method signatures, parameter propagation, and caching key formation |
src/Microsoft.DotNet.Darc/DarcLib/AzureDevOpsClient.cs | Updated GetFilesAtCommitAsync signature to pass repoIsVmr |
Why would we need to specify |
we currently don't have it, but I think we could add it to some wrapper while we're traversing the tree, if you think that'd be a better solution |
I think a more general solution would be passing a more complete path down, if it's feasible. |
I debugged the code, I got it a bit wrong on my first try. The blob type trees have their full path as the |
// We're adding the full path here because the eng/common files have the same relative path in the VMR | ||
// and in product repos relative to the eng/common folder, and we don't want to get bad cache hits. | ||
// Their full paths are different so this mitigates the problem | ||
return await Cache.GetOrCreateAsync((path, treeItem.Path, treeItem.Sha), async (entry) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return await Cache.GetOrCreateAsync((path, treeItem.Path, treeItem.Sha), async (entry) => | |
return await Cache.GetOrCreateAsync(($"{path}/{treeItem.Path}", treeItem.Sha), async (entry) => |
we could also do this, but I don't think we need the extra string interpolation, think the above is more efficient.
#4751