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

Inefficient use of a for loop #10576

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

AsharSi
Copy link

@AsharSi AsharSi commented Mar 16, 2025

Description

This PR improves how HTTP headers are set in the request. Replacing headers.keySet() with headers.entrySet().

This change enhances efficiency by directly accessing both the key and value in a single iteration, rather than fetching the key first and then looking up the value in the map.

Fixes: #10529

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  • Ensured that HTTP requests are still correctly setting headers.
  • Verified that functionality remains unchanged with test cases.

How did you try to break this feature and the system with this change?

Copy link

boring-cyborg bot commented Mar 16, 2025

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

not tested yet

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 16.26%. Comparing base (9c6f2a9) to head (e709eab).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...direct/download/HttpsDirectTemplateDownloader.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #10576   +/-   ##
=========================================
  Coverage     16.26%   16.26%           
  Complexity    13388    13388           
=========================================
  Files          5674     5674           
  Lines        498929   498929           
  Branches      60338    60338           
=========================================
+ Hits          81154    81158    +4     
+ Misses       408736   408732    -4     
  Partials       9039     9039           
Flag Coverage Δ
uitests 3.99% <ø> (ø)
unittests 17.12% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12806

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-12782)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 57709 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10576-t12782-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

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.

Inefficient use of a for loop
4 participants