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

accept recv-only channels for all cancellations #3271

Merged
merged 1 commit into from
Jul 14, 2017

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Jul 14, 2017

Cancellation channels are often derived from a Context, which
returns a directional <-chan struct{} from Done(). In order to use
this with parts of the consul API, one is required to create a new channel
and dispatch a separate goroutine to watch for context cancellation and
close the new channel.

Changing the signature for the methods that take cancellation channels
will allow easier integration with existing uses of Context. Since the
cancellation pattern only reads from these channels, there should be no
backwards incompatibility with existing codebases, and most of the
methods already accept only the correct type.

Cancellation channels are often derived from a Context, which
returns a directional `<-chan struct{}` from Done(). In order to use
this with parts of of the consul API, one is required to create a new
channel and dispatch a separate goroutine to watch for context
cancellation and close the new channel.

Changing the signature for the methods that take cancellation channels
will allow easier integration with existing uses of Context. Since the
cancellation pattern only reads from these channels, there should be no
backwards incompatibility with existing codebases, and most of the
methods already accept only the correct type.
@jbardin jbardin requested a review from slackpad July 14, 2017 20:47
@slackpad slackpad merged commit deb43fe into master Jul 14, 2017
@slackpad slackpad deleted the jbardin/session-renew-with-context branch July 14, 2017 23:31
@slackpad
Copy link
Contributor

LGTM - merged and added to the change log.

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.

2 participants