Skip to content

[feat] Watch() retries 410 errors #327

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

Merged
merged 1 commit into from
Aug 9, 2024
Merged

[feat] Watch() retries 410 errors #327

merged 1 commit into from
Aug 9, 2024

Conversation

tomplus
Copy link
Owner

@tomplus tomplus commented Aug 5, 2024

Fixes #136

Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.15%. Comparing base (2126b1d) to head (a43f780).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #327      +/-   ##
==========================================
+ Coverage   28.11%   28.15%   +0.03%     
==========================================
  Files         779      779              
  Lines       92138    92184      +46     
==========================================
+ Hits        25904    25950      +46     
  Misses      66234    66234              

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

@tomplus tomplus merged commit 7222c98 into master Aug 9, 2024
16 checks passed
@rjhuijsman
Copy link

Thanks for doing this! My team is excited to see this land - hopefully this can go into a release soon! 🙂 🙏🏻

@tomplus
Copy link
Owner Author

tomplus commented Aug 31, 2024

Thank you.
I'm preparing the next release, should be available in the following week.

@tomplus
Copy link
Owner Author

tomplus commented Sep 16, 2024

@rjhuijsman It has been released 🚀

@ianbuss
Copy link

ianbuss commented Sep 17, 2024

One quick question about the semantics of this that I'm not sure of. If the server has responded with a 410, the resource_version in the watch is no longer available server-side, so the reconnect would always fail with another 410 unless the resource_version is reset to None in the watch? _reconnect doesn't reset the resource_version as far as I can see. I've probably missed a subtlety here (e.g. one Kube server may still have the older resource version in its cache).

@tomplus
Copy link
Owner Author

tomplus commented Sep 17, 2024

@ianbuss Thanks for your question.

The idea is to try to reconnect only once with the latest resource_version we have. It may be enough in some situation. If it doesn't help an exception is raised and client has to handle it somehow (probably will fetch list of resources and start watching again).

You are right, that resetting version could make it works forever but we won't be aware that we lost some events. So it's better to make it explicit and raise an exception.

@ianbuss
Copy link

ianbuss commented Sep 17, 2024

@ianbuss Thanks for your question.

The idea is to try to reconnect only once with the latest resource_version we have. It may be enough in some situation. If it doesn't help an exception is raised and client has to handle it somehow (probably will fetch list of resources and start watching again).

You are right, that resetting version could make it works forever but we won't be aware that we lost some events. So it's better to make it explicit and raise an exception.

Agree that is the right call, such cases are best handled by the calling code. The PR interested me as I am developing a general go informer-like library over kubernetes-asyncio for all the core types and 410 Gone is one of the special cases I need to handle. Thanks for the response 👍

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.

Perform automatic retries for 410s during watches
3 participants