mirror of
https://github.com/etcd-io/etcd.git
synced 2026-02-05 15:46:51 +01:00
perf: use RLock in Demoted method for read-only access to expiry
Signed-off-by: huangzw <huangzw@2345.com>
This commit is contained in:
@@ -97,8 +97,8 @@ func (l *Lease) forever() {
|
||||
|
||||
// Demoted returns true if the lease's expiry has been reset to forever.
|
||||
func (l *Lease) Demoted() bool {
|
||||
l.expiryMu.Lock()
|
||||
defer l.expiryMu.Unlock()
|
||||
l.expiryMu.RLock()
|
||||
defer l.expiryMu.RUnlock()
|
||||
return l.expiry == forever
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user