Example #1
0
// Remaining returns the remaining time of the lease.
func (l *Lease) Remaining() time.Duration {
	return time.Duration(l.expiry - monotime.Now())
}
Example #2
0
// refresh refreshes the expiry of the lease.
func (l *Lease) refresh(extend time.Duration) {
	l.expiry = monotime.Now().Add(extend + time.Duration(l.ttl)*time.Second)
}