mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd-runner: update to use new lease interface
This commit is contained in:
parent
b5384ac1c0
commit
78afc853f4
@ -50,7 +50,6 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
|
||||
for {
|
||||
var (
|
||||
l *clientv3.LeaseGrantResponse
|
||||
lk *clientv3.LeaseKeepAliveResponse
|
||||
err error
|
||||
)
|
||||
for {
|
||||
@ -62,13 +61,14 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
|
||||
expire := time.Now().Add(time.Duration(l.TTL-1) * time.Second)
|
||||
|
||||
for {
|
||||
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
|
||||
lk := c.Lease.KeepAliveOnce(ctx, l.ID)
|
||||
err = lk.Err
|
||||
if grpc.Code(err) == codes.NotFound {
|
||||
if time.Since(expire) < 0 {
|
||||
log.Printf("bad renew! exceeded: %v", time.Since(expire))
|
||||
for {
|
||||
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
|
||||
fmt.Println(lk, err)
|
||||
lk = c.Lease.KeepAliveOnce(ctx, l.ID)
|
||||
fmt.Println(lk)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user