Skip to content

Commit

Permalink
Merge pull request #151 from palcalde/pablo/fix-extend
Browse files Browse the repository at this point in the history
Remove clean up on extend fail
  • Loading branch information
hjr265 authored Feb 21, 2024
2 parents c541100 + 879d3ae commit 1bac91c
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,6 @@ func (m *Mutex) touch(ctx context.Context, pool redis.Pool, value string, expiry

status, err := conn.Eval(touchScript, m.name, value, expiry)
if err != nil {
// extend failed: clean up locks
_, _ = func() (int, error) {
ctx, cancel := context.WithTimeout(ctx, time.Duration(int64(float64(m.expiry)*m.timeoutFactor)))
defer cancel()
return m.actOnPoolsAsync(func(pool redis.Pool) (bool, error) {
return m.release(ctx, pool, value)
})
}()
return false, err
}
return status != int64(0), nil
Expand Down

0 comments on commit 1bac91c

Please sign in to comment.