mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-23 13:00:08 +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.
|
// To be called by TTL manager's coroutine only.
|
||||||
func (mgr *ttlmanager) tick() {
|
func (mgr *ttlmanager) tick() {
|
||||||
mgr.RLock()
|
mgr.Lock()
|
||||||
defer mgr.RUnlock()
|
defer mgr.Unlock()
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
batch, err := mgr.ds.Batch()
|
batch, err := mgr.ds.Batch()
|
||||||
|
Loading…
Reference in New Issue
Block a user