Skip to content

Commit

Permalink
clientv3: create keepAliveCtxCloser goroutine only if ctx can be canc…
Browse files Browse the repository at this point in the history
…eled

Signed-off-by: zhangwenkang <[email protected]>
  • Loading branch information
kensou97 committed Jul 9, 2023
1 parent 82f6cb4 commit 21eb8d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/v3/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ func (l *lessor) KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAl
}
l.mu.Unlock()

go l.keepAliveCtxCloser(ctx, id, ka.donec)
if ctx.Done() != nil {
go l.keepAliveCtxCloser(ctx, id, ka.donec)
}
l.firstKeepAliveOnce.Do(func() {
go l.recvKeepAliveLoop()
go l.deadlineLoop()
Expand Down

0 comments on commit 21eb8d2

Please sign in to comment.