mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-06 10:21:05 +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 {
|
func (locker *Leaser) withLease(ctx context.Context, leaseID string) error {
|
||||||
// always release the lock in case the parent context is canceled
|
// always release the lock in case the parent context is canceled
|
||||||
defer func() {
|
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,
|
Name: locker.leaseName,
|
||||||
Id: leaseID,
|
Id: leaseID,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue