diff --git a/etcd/leasedkv.go b/etcd/leasedkv.go index 858c000d8..17a35ed0b 100644 --- a/etcd/leasedkv.go +++ b/etcd/leasedkv.go @@ -66,6 +66,11 @@ func (l *leasedKV) Start(initValue string) error { func (l *leasedKV) create(initValue string) (<-chan *clientv3.LeaseKeepAliveResponse, error) { ctx, cancel := context.WithCancel(context.Background()) + + if l.cancel != nil { + l.cancel() + } + l.cancel = cancel leaseResp, err := l.cli.Grant(ctx, l.ttlSeconds)