mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-13 11:30:09 +08:00
Acquire full lock when ticking ttlmanager
This commit is contained in:
parent
f367209272
commit
c0ff7b9b66
@ -272,8 +272,8 @@ func newTTLManager(parent context.Context, d ds.Datastore, tick time.Duration) *
|
||||
|
||||
// To be called by TTL manager's coroutine only.
|
||||
func (mgr *ttlmanager) tick() {
|
||||
mgr.RLock()
|
||||
defer mgr.RUnlock()
|
||||
mgr.Lock()
|
||||
defer mgr.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
batch, err := mgr.ds.Batch()
|
||||
|
Loading…
Reference in New Issue
Block a user