-
Notifications
You must be signed in to change notification settings - Fork 183
fix: ignore NotFoundError in the first call of LazyDiscoverer. __search #253
fix: ignore NotFoundError in the first call of LazyDiscoverer. __search #253
Conversation
|
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
CLA signature registered |
|
/assign @fabianvf |
dynamic/discovery.py
Outdated
|
|
||
| def search(self, **kwargs): | ||
| # In first call, ignore NotFoundError when raised | ||
| self.__ignore_not_found_error = True |
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.
It may make more sense to just put line 243 into a try... except block, as multiple calls to this method could happen concurrently in which case they could wrestle over the self.__ignore_not_found_error variable
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.
Great suggestion, try-except is safer than use variable.
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.
PR refreshed.
7b1f9fb to
c040d87
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: schneesu, yliaog The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hello @yliaog , does this PR still need to be modified? It seems that the |
|
/lgtm |

What type of PR is this?
/kind bug
What this PR does / why we need it:
According to fabianvf's suggestion, I try to catch the exception in the first call and safely ignore it
kubernetes-client/python#1536 (comment)
Which issue(s) this PR fixes:
Fixes kubernetes-client/python#1536
Does this PR introduce a user-facing change?