clientv3: include a context in Client

Useful for clean up tasks
This commit is contained in:
Anthony Romano
2016-03-03 12:43:03 -08:00
parent 3b185f130a
commit 360aafec76
8 changed files with 47 additions and 28 deletions

View File

@ -64,7 +64,7 @@ func electCommandFunc(cmd *cobra.Command, args []string) {
}
func observe(c *clientv3.Client, election string) error {
e := concurrency.NewElection(context.TODO(), c, election)
e := concurrency.NewElection(c, election)
ctx, cancel := context.WithCancel(context.TODO())
donec := make(chan struct{})
@ -94,7 +94,7 @@ func observe(c *clientv3.Client, election string) error {
}
func campaign(c *clientv3.Client, election string, prop string) error {
e := concurrency.NewElection(context.TODO(), c, election)
e := concurrency.NewElection(c, election)
ctx, cancel := context.WithCancel(context.TODO())
donec := make(chan struct{})