mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-15 08:41:02 +00:00
Call cancel when we try to renew the lease after an error.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
parent
b6810f3ce7
commit
6e6eb962ee
1 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue