mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-24 13:10:06 +08:00
minor cleanup.
This commit is contained in:
parent
3a85498ae8
commit
03a40a855a
pstoreds
@ -213,7 +213,7 @@ func (ab *dsAddrBook) asyncFlush(pr *addrsRecord) {
|
||||
}
|
||||
|
||||
// loadRecord is a read-through fetch. It fetches a record from cache, falling back to the
|
||||
// datastore upon a miss, and returning an newly initialized record if the peer doesn't exist.
|
||||
// datastore upon a miss, and returning a newly initialized record if the peer doesn't exist.
|
||||
//
|
||||
// loadRecord calls Refresh() on the record before returning it. If the record changes
|
||||
// as a result and `update=true`, an async flush is scheduled.
|
||||
|
@ -113,7 +113,6 @@ func TestGCPurging(t *testing.T) {
|
||||
|
||||
<-time.After(2 * time.Second)
|
||||
ab.(*dsAddrBook).purgeCycle()
|
||||
|
||||
if i := tp.countLookaheadEntries(); i != 2 {
|
||||
t.Errorf("expected 2 GC lookahead entries, got: %v", i)
|
||||
}
|
||||
@ -123,18 +122,15 @@ func TestGCPurging(t *testing.T) {
|
||||
|
||||
<-time.After(5 * time.Second)
|
||||
ab.(*dsAddrBook).purgeCycle()
|
||||
|
||||
if i := tp.countLookaheadEntries(); i != 2 {
|
||||
t.Errorf("expected 2 GC lookahead entries, got: %v", i)
|
||||
}
|
||||
|
||||
<-time.After(5 * time.Second)
|
||||
ab.(*dsAddrBook).purgeCycle()
|
||||
|
||||
if i := tp.countLookaheadEntries(); i != 0 {
|
||||
t.Errorf("expected 0 GC lookahead entries, got: %v", i)
|
||||
}
|
||||
|
||||
if i := len(ab.PeersWithAddrs()); i != 0 {
|
||||
t.Errorf("expected 0 entries in database, got: %v", i)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user