Get-VIEventPlus taking a long time on vCenter 8.0u3 and later#767
Open
adam-ahern wants to merge 1 commit intoalanrenouf:masterfrom
Open
Get-VIEventPlus taking a long time on vCenter 8.0u3 and later#767adam-ahern wants to merge 1 commit intoalanrenouf:masterfrom
adam-ahern wants to merge 1 commit intoalanrenouf:masterfrom
Conversation
Reviewer's Guide by SourceryThe Get-VIEventPlus function was taking a long time to execute on vCenter 8.0u3 and later due to retrieving events one by one. To address this, the code was modified to retrieve events in larger batches, significantly improving performance. The number of events retrieved per call was increased from 100 to 1000, and a loop was added to process these batches. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @adam-ahern - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a comment explaining why the event number was increased to 1000.
- It might be worth extracting the event processing logic into a separate function for better readability.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
Tested in my homelab with good results! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue was reported in #766
I was able to reproduce the issue in an 8.0u3 lab using PowerCLI 13.3
Running the vCheck script with Trace set to 1 showed the Get-VIEventPlus going into a long loop to add events to a list checking through each event 1 by 1.
vCheck-vSphere/Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
Lines 465 to 472 in e248cf2
I added code to retrieve more events at a time, and process them in larger batches
Summary by Sourcery
Bug Fixes: