fix: allow global leader lock context merge to be canceled (#16603)

Global leader lock was first designated to only acquired once
until the node is killed. However, currently, the code acquires
it repeatedly during the lifetime of the server, now there is a
goroutine leak.
This commit is contained in:
Anis Elleuch 2023-02-13 10:26:38 +01:00 committed by GitHub
parent 1d3b18c3f4
commit d6d01067a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -63,6 +63,8 @@ func mergeContext(ctx1, ctx2 context.Context) (context.Context, context.CancelFu
select {
case <-ctx1.Done():
case <-ctx2.Done():
// The lock acquirer decides to cancel, exit this goroutine
case <-ctx.Done():
}
cancel()