mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-02-05 06:10:09 +08:00
rename GCPruneInterval to GCPurgeInterval for consistency.
This commit is contained in:
parent
bbff6b7522
commit
c3c24b227a
@ -272,7 +272,7 @@ func (ab *dsAddrBook) background() {
|
||||
go func() {
|
||||
select {
|
||||
case <-time.After(ab.opts.GCInitialDelay):
|
||||
pruneTimer = time.NewTicker(ab.opts.GCPruneInterval)
|
||||
pruneTimer = time.NewTicker(ab.opts.GCPurgeInterval)
|
||||
lookaheadTimer = time.NewTicker(ab.opts.GCLookaheadInterval)
|
||||
}
|
||||
}()
|
||||
|
@ -40,7 +40,7 @@ func TestGCLookahead(t *testing.T) {
|
||||
// effectively disable automatic GC for this test.
|
||||
opts.GCInitialDelay = 90 * time.Hour
|
||||
opts.GCLookaheadInterval = 10 * time.Second
|
||||
opts.GCPruneInterval = 1 * time.Minute
|
||||
opts.GCPurgeInterval = 1 * time.Minute
|
||||
|
||||
factory := addressBookFactory(t, badgerStore, opts)
|
||||
ab, closeFn := factory()
|
||||
@ -85,7 +85,7 @@ func TestGCPurging(t *testing.T) {
|
||||
// effectively disable automatic GC for this test.
|
||||
opts.GCInitialDelay = 90 * time.Hour
|
||||
opts.GCLookaheadInterval = 20 * time.Second
|
||||
opts.GCPruneInterval = 1 * time.Minute
|
||||
opts.GCPurgeInterval = 1 * time.Minute
|
||||
|
||||
factory := addressBookFactory(t, badgerStore, opts)
|
||||
ab, closeFn := factory()
|
||||
|
@ -37,7 +37,7 @@ func TestDsAddrBook(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
opts := DefaultOpts()
|
||||
opts.GCPruneInterval = 1 * time.Second
|
||||
opts.GCPurgeInterval = 1 * time.Second
|
||||
opts.CacheSize = 1024
|
||||
|
||||
pt.TestAddrBook(t, addressBookFactory(t, dsFactory, opts))
|
||||
@ -47,7 +47,7 @@ func TestDsAddrBook(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
opts := DefaultOpts()
|
||||
opts.GCPruneInterval = 1 * time.Second
|
||||
opts.GCPurgeInterval = 1 * time.Second
|
||||
opts.CacheSize = 0
|
||||
|
||||
pt.TestAddrBook(t, addressBookFactory(t, dsFactory, opts))
|
||||
|
@ -19,7 +19,7 @@ type Options struct {
|
||||
CacheSize uint
|
||||
|
||||
// Sweep interval to purge expired addresses from the datastore.
|
||||
GCPruneInterval time.Duration
|
||||
GCPurgeInterval time.Duration
|
||||
|
||||
// Interval to renew the GC lookahead window.
|
||||
GCLookaheadInterval time.Duration
|
||||
@ -36,7 +36,7 @@ type Options struct {
|
||||
func DefaultOpts() Options {
|
||||
return Options{
|
||||
CacheSize: 1024,
|
||||
GCPruneInterval: 5 * time.Minute,
|
||||
GCPurgeInterval: 5 * time.Minute,
|
||||
GCLookaheadInterval: 12 * time.Hour,
|
||||
GCInitialDelay: 60 * time.Second,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user