Skip to content

Commit

Permalink
feat: with fail fast mode for low latency
Browse files Browse the repository at this point in the history
Signed-off-by: rfyiamcool <[email protected]>
  • Loading branch information
rfyiamcool committed Sep 10, 2023
1 parent 96e3b35 commit d21878d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions redsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ func WithValue(v string) Option {
})
}

// With FailFast can be used to quickly acquire and release the locker. We do not need to wait for all redis response results.
// As long as the quorum is met, it will be returned immediately, and requests that have not yet been returned will be processed asynchronously.
// WithFailFast can be used to quickly acquire and release the locker when some redis servers are blocking.
// We do not need to wait for all redis servers response. As long as the quorum is met, it will be returned immediately, and requests that have not yet been returned will be processed asynchronously.
// The effect of this parameter is to achieve low latency, avoid redis blocking causing lock/unlock to not return for a long time.
func WithFailFast(b bool) Option {
return OptionFunc(func(m *Mutex) {
m.failFast = b
Expand Down

0 comments on commit d21878d

Please sign in to comment.