fix: call released on ctx done
This commit is contained in:
parent
112fbb4c51
commit
6bbfac661a
|
@ -67,6 +67,10 @@ func (l *Lock) Lock(ctx context.Context, requestUnlock func()) error {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
err := l.released()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
// Context expired, so we return a timeout
|
// Context expired, so we return a timeout
|
||||||
return tusd.ErrLockTimeout
|
return tusd.ErrLockTimeout
|
||||||
case <-time.After(l.acquirerPollInterval):
|
case <-time.After(l.acquirerPollInterval):
|
||||||
|
|
Loading…
Reference in New Issue