-
Notifications
You must be signed in to change notification settings - Fork 167
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
document that watcher stops see #273 and add each_with_retry #275
base: master
Are you sure you want to change the base?
Conversation
As mentioned on issue #273 I don't think that a logic as @grosser in the specifics of the code: what's the new cc @moolitayer @cben |
end | ||
done |
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.
the only way I see this can be false is if connection was interrupted before at least 1 complete line was received?
it will be false if the user `break` or `return` inside the yield
to know the difference between finished and aborted code has to be inside
the watcher
the simple `loop { }` I did previously will not allow it to ever finish,
that's why I added `each_with_retry` :)
…On Thu, Nov 9, 2017 at 2:18 AM, Beni Cherniavsky-Paskin < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/kubeclient/watch_stream.rb
<#275 (comment)>:
> end
+ done
the only way I see this can be false is if connection was interrupted
before at least 1 complete line was received?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#275 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAsZ_NXlBklUdm9HQTU94oyU48bSJD1ks5s0tF8gaJpZM4QXcOg>
.
|
92b502c
to
927bdd0
Compare
ok to merge this ? |
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.
This is a little non-standard since obj.each
usually returns obj
but im ok with these changes 👍
@simon3z I can haz merge ? |
cc @moolitayer @cben |
Hi, I'm very much aware I owe a review here. Also @pkliczewski now told me apparently official Go client's "informer framework" solves it, hadn't checked it yet. So, about this PR:
IMHO restart logic does belong in kubeclient, but we'd need something more version-aware. |
so "remove |
We are having similar issues when connection is closed and the watcher crashes instead of retrying. +1 for having some logic in the
|
need some way to distinguish "exited intentionally" (.finish/break/return) from connection closed.
I quite forgot this PR. Putting resumption aside, there was a good point here that I'm by now aware of 5 ways watching can exit:
The technical reason is we have (4) vs (5) is clearly a mess. I'm tempted to say user doesn't care how exactly a watch got disconnected — the bottom line is the "infinite" loop got broken, and user needs to resume/retry in If backward compatibility is not a question, I'd argue (3) (4) (5) should all throw an exception. The solution here of returning a boolean has benefit of backward compatibility. But a boolean doesn't cover (3) well. I mean current behavior of passing error data into the block is ... workable, but not elegant. And handling 410 is essential to correct usage if you pass resourceVersion! A "meta" consideration: as we've seen here, there is value in accumulating expereince of how things actually break, and if we just swallow errors into a boolean, there will be no details in logs, so we (kubeclient) will not learn, and users will not learn. I propose to break compatibility (and bump major version) and turn (3) (4) (5) into Kubeclient errors.@grosser @qingling128 @jcantrill @mszabo @Stono @fradee what do you think? [And yes, I still hope in some future version we'll get Kubeclient itself resuming after disconnection. IFF initial resourceVersion was set. And it will still leave caller to handle 410, so I think we need to fix the interface first anyway.] [I'm also working on adding some docs on watching, because README is really lacking...] |
@cben Thanks for working on this. I think it would be a step forward. |
Be aware if you're watching streams that don't change frequently, you'll see 410 GONE quite a bit when you reconnect. Examples are say, CRD's that are rarely updated. When you reconnect you'll likely get a 410 GONE if you're trying to resume from the last seen CRD, and you'll need to resume from 0 instead - dropping any ADDED events with a timestamp <= the start of your stream. |
I'd still like a |
Re #275 (comment): |
Confirmed (3)
This is unfortunate for
|
Thank you for you work and great discussions! any plan for this to be merged? |
nicer alternative to the current
loop { watch }
we are using, could also makeretry: true
an option for each, but wanted to keep it clean@simon3z
/cc @jonmoter