Skip to content

Watcher: notify the caller when the server closes the connection #184

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 6 commits into from
Jun 27, 2018
Merged

Watcher: notify the caller when the server closes the connection #184

merged 6 commits into from
Jun 27, 2018

Conversation

qmfrederik
Copy link
Contributor

@qmfrederik qmfrederik commented Jun 27, 2018

The Kubernetes server can close the connection on any watch call. There's a default timeout of 30-60 minutes, though you can specify a custom timeout when you use the timeoutSeconds parameter.

Let the consumer of the Watcher<T> class know when the server closed the connection, by raising the Closed event or invoking the onClosed callback.

Also regenerates the API and updates the unit tests, so this may best be reviewed on a per-commit basis.

Fixes #181, #165

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 27, 2018
@qmfrederik
Copy link
Contributor Author

Fixes #181, #165

@brendandburns
Copy link
Contributor

Looks reasonable but the unit tests are hanging on Travis for some reason...

- Run Task.Yield at the beginning to make sure we're running async
- Set Watching = false before invoking OnClosed, to make sure the callers see a consistent state.
@qmfrederik
Copy link
Contributor Author

Yeah, should be fixed now. The start of WatcherLoop was running synchronously, which caused a deadlock. I added Task.Yield to force the method to run async from the start.

@brendandburns
Copy link
Contributor

LGTM.

@brendandburns brendandburns merged commit bc1cb62 into kubernetes-client:master Jun 27, 2018
JonJam pushed a commit to JonJam/csharp that referenced this pull request Sep 8, 2018
…ernetes-client#184)

* Watcher: Add onClosed event and callback

* Update the code generators to accept the onClose callback

* Re-generate API

* Update unit tests

* Fix unit test

* Watcher fixes/improvements:
- Run Task.Yield at the beginning to make sure we're running async
- Set Watching = false before invoking OnClosed, to make sure the callers see a consistent state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watchers should send a notification when the connection is closed
3 participants