Skip to content
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

Use context to cancel in-flight requests #192

Merged
merged 1 commit into from
Apr 2, 2020
Merged

Use context to cancel in-flight requests #192

merged 1 commit into from
Apr 2, 2020

Conversation

linki
Copy link
Owner

@linki linki commented Apr 1, 2020

Now that client-go supports a context parameter we can actually support it in chaoskube as well.

I've never used context for anything else other than signal handling (like in chaoskube's main loop) and request timeouts. Both could be applied here but for now I'll use it for the former.

Before, if for some reason the call to the Kubernetes API was hanging, hitting Ctrl+C would just not work. Although the top-level context would have its cancel func called, we'd never read the Done channel until the request is completed, e.g. via some timeout.

Now, the top-level cancellable context is propagated down to client-go and Ctrl+C will actually preempt long running requests and the program can terminate immediately.

@linki linki merged commit 33ff974 into master Apr 2, 2020
@linki linki deleted the context branch April 2, 2020 19:37
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.

1 participant