concurrency: use new lease interface in session

release-3.2
Anthony Romano 2017-04-10 09:41:37 -07:00
parent d5f414f69b
commit f224d74ed7
1 changed files with 2 additions and 5 deletions

View File

@ -51,12 +51,9 @@ func NewSession(client *v3.Client, opts ...SessionOption) (*Session, error) {
}
ctx, cancel := context.WithCancel(ops.ctx)
keepAlive, err := client.KeepAlive(ctx, id)
if err != nil || keepAlive == nil {
return nil, err
}
keepAlive := client.KeepAlive(ctx, id)
donec := make(chan struct{})
s := &Session{client: client, opts: ops, id: id, cancel: cancel, donec: donec}
// keep the lease alive until client error or cancelled context