mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
databroker/leaser: set timeout on ReleaseLease (#5208)
This commit is contained in:
parent
28a20dd153
commit
e2251b2d57
1 changed files with 3 additions and 1 deletions
|
@ -112,7 +112,9 @@ func (locker *Leaser) runOnce(ctx context.Context, resetBackoff func()) error {
|
|||
func (locker *Leaser) withLease(ctx context.Context, leaseID string) error {
|
||||
// always release the lock in case the parent context is canceled
|
||||
defer func() {
|
||||
_, _ = locker.handler.GetDataBrokerServiceClient().ReleaseLease(context.Background(), &ReleaseLeaseRequest{
|
||||
ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), locker.ttl)
|
||||
defer cancel()
|
||||
_, _ = locker.handler.GetDataBrokerServiceClient().ReleaseLease(ctx, &ReleaseLeaseRequest{
|
||||
Name: locker.leaseName,
|
||||
Id: leaseID,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue