-
Notifications
You must be signed in to change notification settings - Fork 36
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
xWindowsUpdateAgent: Added Retry Logic for Known Transient Errors (#24) #92
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #92 +/- ##
=================================
+ Coverage 62% 63% +1%
=================================
Files 2 2
Lines 307 338 +31
=================================
+ Hits 191 215 +24
- Misses 116 123 +7 |
@TravisEz13 As requested, here is the PR! |
return $ExceptionReturnValue | ||
} | ||
# 0x8024402c -2145107924 WU_E_PT_WINHTTP_NAME_NOT_RESOLVED Same as ERROR_WINHTTP_NAME_NOT_RESOLVED - the proxy server or target server name cannot be resolved. wuerror.h | ||
-2145107924 |
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.
Not blocking, but it might be good to refactor this into a function that takes an structure of the errorcode, if it's retryable and warning and iterates over them and does the right thing.
It would reduce code duplication and hopefully make the code easier to read.
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.
I've made this change you suggested.
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.
I don't see anything blocking.
I recommend submitting a PR to update formatting first. It makes things much easier to review.
Codecov Report
@@ Coverage Diff @@
## dev #92 +/- ##
=================================
+ Coverage 62% 64% +1%
=================================
Files 2 2
Lines 307 342 +35
=================================
+ Hits 191 219 +28
- Misses 116 123 +7 |
While I don't disagree that having a separate PR for the formatting changes would be sensible, at this point I would have to faff to separate the changes to do that. I will bare it in mind for future changes however. |
I'm not a maintainer in the repo anymore.... |
cc @johlju |
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.
@pyrostew a few comments. This repo must be converted to the continuous delivery pipeline for us to be able to release a new version (see https://dsccommunity.org/blog/convert-a-module-for-continuous-delivery/). While you look at the review comments I can help convert this repo, but it will take me a week or so due to bandwidth.
Reviewed 3 of 4 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @pyrostew and @TravisEz13)
DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1, line 128 at r2 (raw file):
function Check-Retry
We are not testing if this function actually retries? 🤔
DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1, line 240 at r2 (raw file):
Quoted 4 lines of code…
if(-not (Check-Retry $errorObj)) { return $ExceptionReturnValue }
Not sure we actually unti test this function so that it is actually retrying?
DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1, line 723 at r2 (raw file):
Quoted 8 lines of code…
if ($RetryAttempts -ge 0) { $script:retryAttempts = $RetryAttempts } if ($RetryDelay -ge 0) { $script:retryDelay = $RetryAttempts }
Not seeing this code is needed since it does not call any function that uses them from this function? 🤔
@pyrostew btw thank you for fixing style issues (formatting). There were still issues, but did not comment on that this time since whole repo still need fixing. 🙂 |
Right sorry the delay in replying. Relating to the first 2 comments about not testing, I have added a some test code in the first revision between lines 1395 and 1420, that I think suitably tests the retry logic, it certainly helped with creating the logic in revision 1 then refactoring it for revision 2. Your 3rd comment is quite right, there is no need for that code in the Test-TargetResource, I will remove that and push a new revision. |
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.
Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @TravisEz13)
@pyrostew thank you for this contribution! |
I took longer than expected to convert another repo, but finished with that so I will look into converting this one next, unless someone beat me to it. |
- Added Retry logic to known transient errors (issue #24).
Pull Request (PR) description
Within the Get-WuaWrapper which was already handling some errors, added logic to perform retries on some of the errors that are likely to be transient.
This Pull Request (PR) fixes the following issues
Fixes #24
Task list
Entry should say what was changed, and how that affects users (if applicable).
and comment-based help.
This change is