-
Notifications
You must be signed in to change notification settings - Fork 372
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
Added support for vmSettings' ETag #2294
Conversation
@jscalev FYI |
Codecov Report
@@ Coverage Diff @@
## fast-track #2294 +/- ##
==============================================
+ Coverage 70.60% 70.62% +0.01%
==============================================
Files 96 97 +1
Lines 13917 13939 +22
Branches 1986 1991 +5
==============================================
+ Hits 9826 9844 +18
- Misses 3656 3659 +3
- Partials 435 436 +1
Continue to review full report at Codecov.
|
@@ -666,7 +670,7 @@ def fetch_manifest(self, version_uris, timeout_in_minutes=5, timeout_in_ms=0): | |||
logger.verbose('The specified manifest URL is empty, ignored.') | |||
continue | |||
|
|||
direct_func = lambda: self.fetch(version.uri, max_retry=1) # pylint: disable=W0640 | |||
direct_func = lambda: self.fetch(version.uri, max_retry=1)[0] # pylint: disable=W0640 | |||
# NOTE: the host_func may be called after refreshing the goal state, be careful about any goal state data | |||
# in the lambda. | |||
host_func = lambda: self.fetch_manifest_through_host(version.uri) # pylint: disable=W0640 |
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.
There is a pitfall here that might be a good idea to document. direct_func
and host_func
both reference version.uri
, but version
is a mutating variable declared in a loop. Thus, after the loop, all the lambdas will use the last version.uri
in version_uris_shuffled
. See the pylint page for more info (just Ctrl+F
for W0640
). I believe this isn't an issue right now because we only access these lambdas from inside the loop, but any future code that somehow tries to export a particular direct_func
/host_func
would run into a pretty hard to debug error. Might be worth a code comment.
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.
We create a new closure in each iteration of the loop, so this is not an issue. I can add a comment explaining the suppression on a subsequent PR.
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.
Left a single unresolved comment above about documenting a pitfall, but everything looks good to me, overall.
Use the ETag of the vmSettings API; update extensions goal state only if the ETag changed.