Browse Source

Merge pull request #7330 from fanminshi/fix_keepAliveOnce

clientv3: KeepAliveOnce returns ErrLeaseNotFound if TTL <= 0
fanmin shi 8 năm trước cách đây
mục cha
commit
ad1b754e02
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      clientv3/lease.go

+ 1 - 1
clientv3/lease.go

@@ -255,7 +255,7 @@ func (l *lessor) KeepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAlive
 	for {
 	for {
 		resp, err := l.keepAliveOnce(ctx, id)
 		resp, err := l.keepAliveOnce(ctx, id)
 		if err == nil {
 		if err == nil {
-			if resp.TTL == 0 {
+			if resp.TTL <= 0 {
 				err = rpctypes.ErrLeaseNotFound
 				err = rpctypes.ErrLeaseNotFound
 			}
 			}
 			return resp, err
 			return resp, err