concurrency: use new lease interface in session
parent
d5f414f69b
commit
f224d74ed7
|
@ -51,12 +51,9 @@ func NewSession(client *v3.Client, opts ...SessionOption) (*Session, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(ops.ctx)
|
ctx, cancel := context.WithCancel(ops.ctx)
|
||||||
keepAlive, err := client.KeepAlive(ctx, id)
|
keepAlive := client.KeepAlive(ctx, id)
|
||||||
if err != nil || keepAlive == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
donec := make(chan struct{})
|
donec := make(chan struct{})
|
||||||
|
|
||||||
s := &Session{client: client, opts: ops, id: id, cancel: cancel, donec: donec}
|
s := &Session{client: client, opts: ops, id: id, cancel: cancel, donec: donec}
|
||||||
|
|
||||||
// keep the lease alive until client error or cancelled context
|
// keep the lease alive until client error or cancelled context
|
||||||
|
|
Loading…
Reference in New Issue