mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
concurrency: use new lease interface in session
This commit is contained in:
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…
x
Reference in New Issue
Block a user