Skip to content
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

Add Cache Control when uploading devices models images #1044

Merged
merged 5 commits into from
Aug 9, 2022

Conversation

hocinehacherouf
Copy link
Contributor

Description

What's new?

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #1044 (5b952d3) into main (8bc2baf) will increase coverage by 0.14%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1044      +/-   ##
==========================================
+ Coverage   85.30%   85.45%   +0.14%     
==========================================
  Files         179      179              
  Lines        5847     5859      +12     
==========================================
+ Hits         4988     5007      +19     
+ Misses        859      852       -7     
Impacted Files Coverage Δ
src/AzureIoTHub.Portal/Server/ConfigHandler.cs 0.00% <ø> (ø)
...reIoTHub.Portal/Server/DevelopmentConfigHandler.cs 78.12% <100.00%> (+0.70%) ⬆️
....Portal/Server/Managers/DeviceModelImageManager.cs 57.62% <100.00%> (+22.93%) ⬆️
...ureIoTHub.Portal/Server/ProductionConfigHandler.cs 78.12% <100.00%> (+0.70%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@hocinehacherouf hocinehacherouf changed the title Add unit test on ChangeDeviceModelImageAsync #763 Add Cache Control when uploading devices models images Aug 9, 2022
Comment on lines +111 to +116
await foreach (var blob in container.GetBlobsAsync())
{
var blobClient = container.GetBlobClient(blob.Name);

_ = await blobClient.SetHttpHeadersAsync(new BlobHttpHeaders { CacheControl = $"max-age={this.configHandler.StorageAccountDeviceModelImageMaxAge}, must-revalidate" });
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Select

This foreach loop immediately maps its iteration variable to another variable [here](1) - consider mapping the sequence explicitly using '.Select(...)'.
@hocinehacherouf hocinehacherouf marked this pull request as ready for review August 9, 2022 11:52
@hocinehacherouf hocinehacherouf requested a review from a team as a code owner August 9, 2022 11:52
@hocinehacherouf hocinehacherouf force-pushed the feature/763_change_image_url_when_update branch from 7e06b24 to 5b952d3 Compare August 9, 2022 14:46
@hocinehacherouf hocinehacherouf enabled auto-merge (squash) August 9, 2022 14:46
@hocinehacherouf hocinehacherouf merged commit daca354 into main Aug 9, 2022
@hocinehacherouf hocinehacherouf deleted the feature/763_change_image_url_when_update branch August 9, 2022 14:55
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.

Feature: Avoid usage of browser cache after updating the image of a device model
2 participants