Improve efficiency of restore module logic
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
Current implementation to pull modules from OCI Registry acquires a lock after downloading the blobs, instead we should acquire a lock before downloading the blobs so that we are wasting IO resources.
Notice how in [TryWriteModuleContentAsync](https://github.com/Azure/bicep/blob/adeab531f8b39c1bc1d7a3d14008203133578587/src/Bicep.Core/Registry/ExternalModuleRegistry.cs#L39), the lock is acquired but the implementation of [WriteModuleContent](https://github.com/Azure/bicep/blob/adeab531f8b39c1bc1d7a3d14008203133578587/src/Bicep.Core/Registry/OciModuleRegistry.cs#L210) in the OciModuleRegistry class the OciArtifactResult has already been downloaded by the time the function is invoked
Contributor guide
Research direction
Start with TryWriteModuleContentAsync in src/Bicep.Core/Registry/ExternalModuleRegistry.cs and follow its call into WriteModuleContent in src/Bicep.Core/Registry/OciModuleRegistry.cs. Confirm where OciArtifactResult is downloaded and where the lock is acquired; done means the lock is held before blob downloads so concurrent restores do not waste IO.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100