1
0
mirror of https://github.com/libp2p/go-libp2p-peerstore.git synced 2025-03-24 13:10:06 +08:00

Acquire full lock when ticking ttlmanager

This commit is contained in:
Cole Brown 2018-06-26 18:10:10 -04:00
parent f367209272
commit c0ff7b9b66

View File

@ -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()