Skip to content

Commit

Permalink
improve fn comments
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerinthenight committed Nov 22, 2024
1 parent f0bb696 commit 4a76b9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spindle.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type withDuration int64

func (w withDuration) Apply(o *Lock) { o.duration = int64(w) }

// WithDuration sets the locker's lease duration. Minimum is 1s.
// WithDuration sets the locker's lease duration in ms. Minimum is 1000ms.
func WithDuration(v int64) Option { return withDuration(v) }

type withLogger struct{ l *log.Logger }
Expand Down Expand Up @@ -288,7 +288,8 @@ func (l *Lock) HasLock() (bool, uint64) {
return false, token
}

// HasLock2 is HasLock but return the leader id as well.
// HasLock2 is the same as HasLock but returns the leader id as well. Recommended
// instead of calling both HasLock() and Leader() functions.
func (l *Lock) HasLock2() (bool, string, uint64) {
if l.active.Load() == 0 {
return false, "", 0
Expand Down

0 comments on commit 4a76b9c

Please sign in to comment.