-
Notifications
You must be signed in to change notification settings - Fork 305
Add a WatchAsync method. #308
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
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns 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 |
53b3ed6
to
542df90
Compare
examples/watch/Program.cs
Outdated
var podlistResp = client.ListNamespacedPodWithHttpMessagesAsync("default", watch: true).Result; | ||
using (podlistResp.Watch<V1Pod>((type, item) => | ||
var podlistResp = client.ListNamespacedPodWithHttpMessagesAsync("default", watch: true); | ||
using (podlistResp.WatchAsync<V1Pod, V1PodList>((type, item) => |
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.
do you want
using (await ...)
here using is to dispose Task
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.
I don't think so, because the whole goal was to print the 'ctl-c to cancel' before the wait completes, but perhaps I should drop the 'using' part..
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.
await WatchAsync
creates a new Watcher which will not block running to code inside using
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.
fwiw, you can't use await here because then the Main would have to be async and dotnet doesn't like that. I tried using .Result
but it hangs w/o printing the ctrl-c
stuff.
I'm open to suggestions, but for now I think this is the best we can do (or we could just remove the using
syntax...)
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.
Actually, I just rewrote the code to avoid the using
directive and to call Dispose
directly.
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.
examples/watch/Program.cs
Outdated
var podlistResp = client.ListNamespacedPodWithHttpMessagesAsync("default", watch: true).Result; | ||
using (podlistResp.Watch<V1Pod>((type, item) => | ||
var podlistResp = client.ListNamespacedPodWithHttpMessagesAsync("default", watch: true); | ||
using (podlistResp.WatchAsync<V1Pod, V1PodList>((type, item) => |
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.
using (podlistResp.WatchAsync<V1Pod, V1PodList>((type, item) => | |
using (await podlistResp.WatchAsync<V1Pod, V1PodList>((type, item) => |
Comment addressed, please take another look. |
close via #313 |
@brendandburns: PR needs rebase. 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. |
Closes #301