Skip to content

Commit

Permalink
Merge pull request #18 from keegancsmith/skip-delay
Browse files Browse the repository at this point in the history
Skip delay on last try to lock
  • Loading branch information
hjr265 committed Jul 19, 2016
2 parents 78ab702 + 9ef9e07 commit 688f6d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redsync/mutex.go
Expand Up @@ -231,6 +231,11 @@ func (m *Mutex) Lock() error {
}
}

// Have no delay on the last try so we can return ErrFailed sooner.
if i == retries-1 {
continue
}

delay := m.Delay
if delay == 0 {
delay = DefaultDelay
Expand Down

0 comments on commit 688f6d3

Please sign in to comment.